Types of Attributes in the ER Model
Attributes are simple or composite, single valued or multivalued, stored or derived, and may be complex, key or null valued. Each type converts into tables differently, which is why the classification matters.
-
DBMS Fundamentals
- Data, Information and Databases
- What a DBMS Is and Why It Exists
- File System versus DBMS
- Advantages and Limitations of a DBMS
- Database Users and the Role of the DBA
- Three Level Architecture and Data Abstraction
- Logical and Physical Data Independence
- Schema, Instance and Metadata
- Database Applications and the Database System Environment
- Database Architecture
- Data Models
-
ER Model
- Entities, Entity Sets and Entity Types
- Types of Attributes in the ER Model
- Keys in the ER Model
- Relationships, Relationship Sets and Degree
- Cardinality and Participation Constraints
- Strong and Weak Entities
- Drawing and Reading ER Diagrams
- Extended ER: Generalisation, Specialisation and Aggregation
- Converting an ER Diagram into Relational Tables
- ER Design Projects
- Relational Model
- Relational Algebra
- Functional Dependencies
-
Normalisation
- Why Normalisation Exists: Anomalies and Redundancy
- First Normal Form
- Second Normal Form and Partial Dependency
- Third Normal Form and Transitive Dependency
- BCNF and BCNF Decomposition
- 4NF, 5NF, Multivalued and Join Dependencies
- Lossless Decomposition and Dependency Preservation
- Complete Worked Normalisation: Unnormalised to BCNF
- Denormalisation and When to Use It
Concept
An attribute is a property of an entity type. Every attribute has a domain — the set of values it may take. The classification below is examined directly and, more usefully, decides how each attribute becomes a column later.
Simple and composite
| Simple (atomic) | Composite | |
|---|---|---|
| Definition | Cannot be divided into meaningful parts | Can be divided into smaller attributes |
| Example | roll_no, marks, dob | name into first and last; address into street, city, pincode |
| Notation | Plain ellipse | Ellipse with child ellipses attached |
| Becomes | One column | Usually one column per leaf part |
( address )
/ |
/ |
(street) (city) (pincode)
Store the LEAVES as columns. Keeping the whole thing in one
column makes "everyone in Chennai" impossible to answer
reliably.Single valued and multivalued
| Single valued | Multivalued | |
|---|---|---|
| Definition | Exactly one value per entity | Several values per entity |
| Example | date of birth, roll number | phone numbers, skills, email addresses |
| Notation | Single ellipse | Double ellipse |
| Becomes | One column | A separate table, never repeated columns |
WRONG RIGHT
students students
roll_no roll_no
phone1 student_phones
phone2 roll_no
phone3 phone
primary key (roll_no, phone)
The wrong version breaks the moment somebody has a fourth
number, and wastes space on everyone who has one. This is
also exactly what 1NF forbids, so the two topics agree.Stored and derived
- Stored — held in the database. Date of birth.
- Derived — computed when needed from other data. Age, computed from date of birth and today.
A derived attribute is drawn with a dashed ellipse. Store the stored one and derive the other; storing age means it is wrong the next morning.
Complex attributes
A complex attribute is composite and multivalued at the same time — for example, several addresses, each having street, city and pincode. Notation nests the two symbols. In tables this always becomes a separate table.
Key attributes and null values
- A key attribute uniquely identifies each entity of the type, and is drawn underlined.
- A null value means not applicable, unknown, or not yet supplied. The three meanings are different and are treated fully in the relational phase, but the design decision belongs here: an attribute that is null for most entities is often a sign that a separate entity type is hiding.
The complete summary
| Type | Notation | Example | Converts to |
|---|---|---|---|
| Simple | Ellipse | marks | One column |
| Composite | Ellipse with children | address | One column per leaf |
| Single valued | Ellipse | dob | One column |
| Multivalued | Double ellipse | phone | Separate table |
| Derived | Dashed ellipse | age | No column — computed |
| Complex | Nested | several addresses | Separate table |
| Key | Underlined | roll_no | Primary key |
Example
STUDENT with every attribute type present
roll_no key, underlined
name composite -> first_name, last_name
dob simple, stored
age derived, dashed - never stored
phone multivalued, double ellipse
address composite -> street, city, pincode
Resulting tables:
students ( roll_no, first_name, last_name, dob,
street, city, pincode )
student_phones ( roll_no, phone )
Two tables, because ONE multivalued attribute was present.Common mistakes
- Storing a multivalued attribute as phone1, phone2, phone3. It breaks on the next value, wastes space, and makes searching all numbers awkward.
- Storing a derived attribute. Age stored today is wrong tomorrow. Store the basis, derive the result.
- Keeping a composite attribute in one column. It defeats searching and sorting by its parts.
- Confusing composite with multivalued. Composite means one value with parts; multivalued means several values.
- Forgetting to underline the key attribute. Marks are given for the notation.
Exam and interview questions
- List all attribute types with their notation and one example each.
- Differentiate composite and multivalued attributes.
- How is a multivalued attribute converted into tables, and why not as repeated columns?
- Why should a derived attribute not be stored, and when might you store one anyway?
- What is a complex attribute?
Practice
- Classify each for an EMPLOYEE: employee id, full name, skills, salary, years of service, home address, dependants.
- Convert an EMPLOYEE with a multivalued skills attribute into tables and state the primary key of each.
- Give one case where storing a derived attribute is justified, and name the risk it creates.
Conclusion
Simple or composite, single or multivalued, stored or derived, plus complex and key attributes. Learn the notation for the exam and the conversion rule for real work: multivalued and complex attributes always become their own table.