n-ary Relation
Context: FIT1058_MOC Β· generalises the Binary Relation to columns Β· the formal model of a relational database table Β· counted via the Power Set
Quick Revision
- π― Objective: a subset of an -fold Cartesian product β a set of -tuples β the model of a relational table.
- π¦ Core Components: domains β tuples (rows) β counted by the Power Set.
- β‘ Key Constraint: relations () vastly outnumber functions ().
π Core
1. The Relation ( Columns)
- Definition β β a set of ordered -tuples, -th from .
- -th domain β ; common cases (binary), (ternary).
2. Databases
- Table = relation β each column is a domain , each row is a tuple.
- Why βrelationalβ β data is literally a set of tuples from a product.
- Projection β extracting two columns yields a Binary Relation.
3. Counting via the Power Set
- All relations β subsets of the product βΉ its Power Set.
- Formulas β (), (on ), (-ary).
Key identities:
βοΈ Core Decision Matrix
| Object | Count () | Constraint |
|---|---|---|
| binary relation | none | |
| relation on | none | |
| function | single-valued + total | |
| -ary relation | none |
When It Flips: recovers the Binary Relation; restricting to single-valued total tuples recovers multi-argument functions . Dropping single-valuedness explodes to .
π Exam Execution Trace
Manual Execution Trace
, :
| Step / State | Object | Formula | Value |
|---|---|---|---|
| 0 (Init) | β | β | β |
| 1 | relations | 64 | |
| 2 | relations on | 16 | |
| 3 | functions | 9 |
β οΈ Common Mistakes
- π‘ Tuples are ordered β column order is part of the schema; relations vastly outnumber functions because each of the pairs is independently in or out.
π§ Active Recall
Why is a relational database table an -ary relation, and what plays the role of domains and tuples?
- Hint: Columns = domains, rows = tuples.
Answer
- Short answer: A table is a subset of ; columns are domains, rows are -tuples.
- Why: Relational β the data is a set of tuples from a Cartesian Product.
How many binary relations are there, and why far more than functions?
- Hint: Power set of the product.
Answer
- Short answer: relations (any subset of ); only functions.
- Why: No single-valued constraint β each of the pairs is independently included.