Relational Model: Domains, Tuples & Cardinality
The relational model is deceptively simple: data lives in tables, and queries describe the result instead of the navigation path.
In plain English
A table is a sheet of graph paper: columns are labels and rows are records.
The one idea
A relation is a set of tuples over named, typed domains; row order and duplicate tuples are not part of the model.
Set semantics are what let the optimizer reorder joins, push filters, and return the same answer by a different plan.
By the end
- 01Define relation, tuple, attribute, domain, degree, and cardinality.
- 02Distinguish a schema from an instance.
- 03Explain why the relational model is declarative.
- 04Read a relation as a set of tuples.
Relations, tuples, and attributes
A relation is a table with a fixed set of columns. A tuple is a row. An attribute is a named column. A domain is the set of allowed values for an attribute, such as integers or dates. The degree is the number of attributes; the cardinality is the number of tuples. A relation is a set, so duplicate rows are not allowed in the pure model.
Student(id, name, age)
degree = 3
cardinality = 4
{ (1, Ada, 21),
(2, Grace, 22),
(3, Linus, 20),
(4, Margaret, 23) }Schema versus instance
The schema is the structure: relation names, attributes, domains, and constraints. The instance is the data at a particular moment. The schema changes rarely; the instance changes constantly. A database catalog stores the schema and metadata.
Declarative access
In the relational model, you describe the result you want, not the pointer path to it. The DBMS chooses an execution plan using indexes, statistics, and join algorithms. This logical independence is why relational systems became the default for general-purpose data.
Enrollment is a set
A relation Enrollment has student_id, course_id, and grade. Two identical rows would mean the same student took the same course with the same grade twice.
Insert (1, C1, A) twice.
A true relation keeps one tuple; SQL may keep both unless a key forbids it.
Project only course_id.
Duplicate course values collapse in relational algebra; SQL needs DISTINCT.
Join Enrollment with Student on student_id.
The result is a new relation with a combined schema.
ConclusionThe relational model is small: domains, tuples, relations, and operations. Its power comes from closing every operation over relations.
The trade-off
No free correctness.
Gain
Declarative queries, set-based optimization, and a simple logical model.
Cost
Joins can be expensive, and real SQL systems reintroduce duplicates and nulls.
Verdict
The default model for business data because it separates meaning from navigation.
Recap
What to keep.
Takeaways
- +A relation is a table; a tuple is a row; an attribute is a column.
- +A domain defines the allowed values of an attribute.
- +Degree counts attributes; cardinality counts tuples.
- +The schema is structure; the instance is current data.
- +Relational queries are declarative.
Traps
- !Confusing degree with cardinality.
- !Assuming a table must have a primary key in the pure model; keys are constraints.
- !Forgetting that a relation is a set, not a bag.
Focus
- →Compute degree and cardinality from a small table.
- →Give an example of a domain.
- →Explain declarative versus navigational access.
Check yourself
Before you turn the page.
What is the degree of a relation?
What is the cardinality of a relation?