Degree
Degree
Definition
The degree (or arity) of a relation is the number of attributes in its relation schema. It is a property of the SCHEMA, and therefore fixed — it does not change unless the schema itself changes (e.g., adding or dropping a column).
Example
Students(id, name, department, gpa) has degree 4 (four attributes). A relation with a single attribute, e.g. DistinctDepartments(department), has degree 1 ("unary"); two attributes = "binary"; three = "ternary"; n attributes = "n-ary."
How this differs from Cardinality (its closest sibling)
- Degree counts COLUMNS (attributes) — a schema-level, structural property.
- Cardinality counts ROWS (tuples) — an instance-level, data property.
- Degree is stable over the relation's lifetime (until a schema change); cardinality fluctuates with every INSERT/DELETE. This is the single most commonly confused pair of terms in relational-model vocabulary — always map "Degree → columns/schema/fixed" and "Cardinality → rows/data/changing."
Edge Cases
- A relation with degree 0 is a theoretical curiosity (a schema with no attributes at all) — practically never used, but valid in relational algebra (e.g., the DUM/DEE relations used in some formalisms to represent TRUE/FALSE).
- Running
ALTER TABLE ... ADD COLUMNincreases the degree by 1 for ALL existing and future tuples — every existing row must now conform to the new degree, typically receiving NULL for the new attribute. - Degree is completely unaffected by how many rows exist — an empty relation and a million-row relation on the identical schema have identical degree.
Key Takeaways / Q&A
Q: If a table has 4 columns and 10,000 rows, what is its degree? A: 4 — degree only counts columns; it never counts rows.
Q: Does degree change when data is inserted or deleted? A: No — only schema changes (adding or removing attributes) change the degree.