Data Models: ER Model and Relational Model
A data model is used to represent the structure of data in a database. Two of the most common data models are the ER model and the relational model.
- ER Model: a diagrammatic representation of the logical structure of a database.
- Relational Model: data represented using a collection of tables.
Tables, Rows, and Columns
The relational model organizes data into tables. Three terms describe the parts of a table:
- Table or Relation: the structure that holds the data.
- Row or Record: a single entry in the table.
- Column or Field: a single property recorded for every row.
| Roll_no | Name | Age |
|---|---|---|
| 1 | Gaurav | 20 |
| 2 | Rahul | 19 |
| 3 | Dhruv | 20 |
| 4 | Anjali | 19 |
This complete table is called the Student Entity Set, and each row in it represents an entity. There is no separate primary key column here, but Roll_no can still identify each student uniquely.
Entity Sets, Attributes, and Relationship Sets
An ER diagram is built from three parts, each with its own shape:
- Entity Set: a set of entities of the same type, such as the Student entity set above — drawn as a rectangle.
- Attributes: the properties that describe an entity, such as Roll_no, Name, and Age — drawn as an oval.
- Key Attribute: an attribute that identifies each entity uniquely, such as Roll_no — underlined in the diagram.
- Relationship Set: an association among several entities, such as enrolls in — drawn as a diamond.

- Entity Set: a set of entities of the same type, e.g. all students — drawn as a rectangle.
- Attributes: the properties describing an entity, e.g. Roll_no, Name, Age — drawn as an oval.
- Key Attribute: identifies each entity uniquely, e.g. Roll_no — underlined in the diagram.
- Relationship Set: an association among entities, e.g. enrolls in — drawn as a diamond.
Strong and Weak Entity Sets
Every entity set is either strong or weak, depending on whether it has its own primary key.
- Strong Entity Set: has its own primary key; drawn as a single rectangle.
- Weak Entity Set: has no primary key of its own — it is identified only by combining a partial key (called a discriminator) with the primary key of the strong entity set it depends on; drawn as a double rectangle.

- No primary key of its own
- Identified via a discriminator
- Drawn as a double rectangle
- Example - a Dependent of Employee
- Has its own primary key
- Identified by its own key attribute
- Drawn as a single rectangle
- Example - Student by Roll_no
Strong and Weak Relationship Sets
A relationship set is also either strong or weak, depending on the entity sets it connects.
- Strong Relationship Set: exists between two strong entity sets; drawn as a single diamond.
- Weak Relationship Set: exists between a strong entity set and a weak entity set. It is also called the identifying relationship, because it is what identifies the weak entity; drawn as a double diamond.

- Links a strong and a weak entity set
- Also called the identifying relationship
- Drawn as a double diamond
- Example - Employee has Dependent
- Links two strong entity sets
- An ordinary relationship set
- Drawn as a single diamond
- Example - Student enrolls in Course
That covers data models, tables, and the building blocks of an ER diagram. The next part builds on these basics.
Drafted with AI assistance from an author outline and edited by TechToolsHQ.
