Skip to content
C

Attribute


Attribute

Definition

An attribute is a named column or property of a relation schema — it labels a role that a domain of values plays within the relation. An attribute is not a value itself; it is the name (e.g., "gpa") bound to a domain of legal values and to one fixed position within every tuple of the relation.

Example

Students(id, name, department, gpa) has 4 attributes: id, name, department, gpa. In the tuple (3, Meera, CS, 9.1), the attribute gpa takes the value 9.1 for this particular tuple.

How this differs from Tuple / Domain

  • A Tuple is a full row of values; an Attribute is a single column/label shared by every tuple.
  • A Domain is the set of legal values an attribute may take (e.g., gpa's domain could be decimal values in [0.0, 10.0]). The Attribute is the name/role; the Domain is the pool of allowed values behind it.

Edge Cases

  • Two different attributes can share the same domain — e.g., "advisor_id" and "id" might both draw from the integer-ID domain — yet remain distinct attributes with different meanings. This is exactly why foreign keys work: same domain, different attribute, deliberately linked.
  • Attribute names must be unique within one relation schema, but the same name can be reused across different relations (e.g., "id" appears in both Students and Courses) without conflict.
  • Renaming an attribute (the rename operator, ρ, in relational algebra) changes only the schema's labeling — the underlying values are untouched.

Key Takeaways / Q&A

Q: Is "gpa" a value or an attribute? A: It is an attribute name; 9.1 is the value that attribute holds in a given tuple.

Q: Can an attribute's domain change without changing the relation schema? A: No — the domain is part of the schema definition for that attribute, so changing it (e.g., widening a numeric range) is itself a schema change.

Mock Test

  • Attribute - Quick Test

    8 questions on Attribute.

    8 questions · 8 min · Medium
    Start Mock Test