What is a relation anyway?

Short story: A relation is a set of tuples that share the same properties. Each tuple is unique.

Short image:

title genre admissions
Heidi FIC 558'837
Schellen-Ursli FIC 456'434
Die göttliche Ordnung FIC 357'413
Wolkenbruch FIC 312'816
More Than Honey DOC 256'195
Der Verdingbub FIC 250'196
Zwingli FIC 248'923
Platzspitzbaby FIC 207'885
Ma vie de Courgette ANI 179'328
Bruno Manser FIC 178'005

A relation can be represented in a tabular form.

Each row is a tuple. Each column is a property.

Each property represents a domain. Titles are text, genre one of FIC, DOC, ANI, admission numbers.

With the Relation language, we keep it simple: All values are of the domain text of any length. However, they can behave like numbers if the context needs it.

Having this relation, we can now start questions.

What is total number of admissions?

admissions_sum
3'006'032

What is the share of admissions by genre?

genre share
FIC 86%
DOC 9%
ANI 6%

Now let's have another relation.

title distributor
Bruno Manser Elite
Der Verdingbub Elite
Die göttliche Ordnung Filmcoopi
Heidi Disney
Ma vie de Courgette Praesens
More Than Honey Frenetic
Platzspitzbaby Elite
Schellen-Ursli Frenetic
Wolkenbruch DCM Film
Zwingli Elite

We can now ask questions on both relations, based on their common poperty title.

How many films and admissions got each distributor?

distributor title_count admissions_sum
Elite 4 885'009
Frenetic 2 712'629
Disney 1 558'837
Filmcoopi 1 357'413
DCM Film 1 312'816
Praesens 1 179'328

This is more or less all we do with relations. We filter, combine, aggregate to get consise information.

What you read here, is itself the output of a Relation document. You program and you comment. And once you have done it, you could reuse the code with other data.