A relation is a finite set of typed rows with no duplicate row.

highlighted = computed this step

Relations before SQL

Honesty note: set algebra not SQL bag/NULL, tiny finite tables, no product/perf claims. This book uses set semantics: no duplicate rows and no NULLs; bag or multiset duplicates and NULL behavior are covered in the next book. Note: arity means column count, and cardinality means row count.

set relation\text{set relation}

Students as a relation

The first relation displays student identifiers paired with names. Its recomputed arity is 2 and its recomputed cardinality is 3. Note: the order shown is canonical display order, not author-supplied truth.

arity=2,cardinality=3\text{arity}=2,\quad \text{cardinality}=3

set algebra not SQL bag/NULL, tiny finite tables, no product/perf claims

Studentssidnames1Anns2Bos3Cy

Enroll as a relation

The second relation displays enrollments with the same set rule: a duplicate row would be rejected. Its recomputed arity is 2 and its recomputed cardinality is 3.

arity=2,cardinality=3\text{arity}=2,\quad \text{cardinality}=3

set algebra not SQL bag/NULL, tiny finite tables, no product/perf claims

Enrollsidcourses1DBs1OSs2DB

Summary

A relation is a set of typed rows with arity and cardinality as separate facts. Note: SQL duplicate-preserving behavior and NULL behavior belong to the next book.

set boundary\text{set boundary}