Q.Differentiate between the terms Attribute and Domain in the context of Relational Data Model.
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →An attribute is a column (property) of a relation, while a domain is the set of permissible values that an attribute can take — the attribute is the name, the domain is the allowed data type and range.
The Core Idea
Think of a relation (table) as a spreadsheet of facts. Each column has a name — that's the attribute. But every column also has a type of data it can hold: numbers, text, dates, etc. That type, along with any constraints on the values, is the domain. The attribute is what we're storing; the domain is how we constrain what can be stored there. This is a core idea in CBSE Class 12 Computer Science relational database concepts.
For example, in a Student table, you might have an attribute called age. The domain of age could be "integers between 1 and 120". The attribute is the label; the domain is the rulebook for valid entries.
Step-by-Step Breakdown
-
Attribute: The Column Name
An attribute is a named column of a relation. It represents a property or characteristic of the entity described by the relation.
- Example: In
Student(roll_no, name, age), the attributes areroll_no,name, andage. - Each attribute has a unique name within the relation schema.
- Example: In
-
Domain: The Set of Allowed Values
A domain is a set of atomic (indivisible) values from which one or more attributes draw their actual values. It defines the data type, length, and any constraints.
- Example: the domain of
agecould be all integers x such that 1 <= x <= 120. - Domains are often shared across attributes — e.g., both
student_ageandteacher_agemight use the same domain of "positive integers up to 120".
- Example: the domain of
-
Key Difference: Name vs. Value Space
The attribute is the label; the domain is the pool of legal values.
- Two different attributes (e.g.,
ageandyears_of_experience) can share the same domain. - An attribute cannot exist without a domain — every attribute must be defined over some domain.
- Two different attributes (e.g.,
-
Formal Definition in Relational Model
In Codd's relational model:
- A relation schema R(A1, A2, ..., An) has attributes A1 ... An.
- Each attribute Ai is associated with a domain Di.
- A tuple t in the relation assigns to each attribute Ai a value v such that v belongs to Di.
A neat way to remember: Attribute = column header, Domain = the "type" of that column (like INTEGER, VARCHAR(50), or a custom set like {'M','F'}). In SQL, the domain is essentially the data type plus any CHECK constraints.
- Example to Cement the Idea
Consider a relation
Employee(emp_id, salary, gender).- Attributes:
emp_id,salary,gender. - Domains:
emp_id: domain = 6-digit positive integers. …
- Attributes:
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.