Skip to content

DB-table-vs-ER

DB-table-vs-ER

In database design, an Entity corresponds to a single Row, while an Entity Set represents the entire Table.

Here is the precise mapping (āϏ⧁āύāĻŋāĻ°ā§āĻĻāĻŋāĻˇā§āϟ āϰ⧂āĻĒāĻžāĻ¨ā§āϤāϰ) between ER Model concepts and Relational Tables:

ER Model Concept Relational Table Equivalent Real-Life Example (āĻŦāĻžāĻ¸ā§āϤāĻŦ āωāĻĻāĻžāĻšāϰāĻŖ)
Entity Set (āϏāĻ¤ā§āϤāĻž āϏ⧇āϟ) The entire Table (āϏāĻŽā§āĻĒā§‚āĻ°ā§āĻŖ āĻŸā§‡āĻŦāĻŋāϞ) The whole Students table containing all records
Entity (āϏāĻ¤ā§āϤāĻž) A single Row / Record (āĻāĻ•āϟāĻŋ āύāĻŋāĻ°ā§āĻĻāĻŋāĻˇā§āϟ āϰ⧋) Rahim's individual record (ID: 101, Age: 20)
Attribute (āĻŦ⧈āĻļāĻŋāĻˇā§āĻŸā§āϝ) A Column / Field (āĻāĻ•āϟāĻŋ āϏāĻŽā§āĻĒā§‚āĻ°ā§āĻŖ āĻ•āϞāĻžāĻŽ) The Phone_Number or Email column header
Attribute Value (āύāĻŋāĻ°ā§āĻĻāĻŋāĻˇā§āϟ āĻŽāĻžāύ) A single Cell (āĻāĻ•āϟāĻŋ āύāĻŋāĻ°ā§āĻĻāĻŋāĻˇā§āϟ āϘāϰ) The actual value "01712..." inside Rahim's row
Relationship (āϏāĻŽā§āĻĒāĻ°ā§āĻ•) Foreign Key / Table Join (āϏāĻ‚āϝ⧋āĻ—) Linking the Students table to the Departments table

Detailed Breakdown

  • Entity vs. Entity Set:
  • Entity (āϏāĻ¤ā§āϤāĻž): A single, distinguishable (āφāϞāĻžāĻĻāĻžāĻ­āĻžāĻŦ⧇ āĻšā§‡āύāĻž āϝāĻžā§Ÿ āĻāĻŽāύ) real-world object. Inside a database table, one individual Row (āϰ⧇āĻ•āĻ°ā§āĻĄ) represents one entity.
  • Entity Set (āϏāĻ¤ā§āϤāĻž āϏ⧇āϟ): A collection (āϏāĻŽāĻˇā§āϟāĻŋ) of similar entities. Because a table holds all rows together, the entire Table is the entity set.

  • Attribute vs. Cell:

  • Attribute (āĻŦ⧈āĻļāĻŋāĻˇā§āĻŸā§āϝ): A named property (āĻŦ⧈āĻļāĻŋāĻˇā§āĻŸā§āϝ/āĻ•āϞāĻžāĻŽā§‡āϰ āύāĻžāĻŽ) that defines an entity. In a table, this corresponds to the entire Column (e.g., Age, Address).
  • Cell (āύāĻŋāĻ°ā§āĻĻāĻŋāĻˇā§āϟ āϘāϰ): A cell represents the intersection (āϛ⧇āĻĻāĻŦāĻŋāĻ¨ā§āĻĻ⧁) between a specific row and a column. It stores the Attribute Value (āϝ⧇āĻŽāύ: āϰāĻšāĻŋāĻŽā§‡āϰ āύāĻŋāĻ°ā§āĻĻāĻŋāĻˇā§āϟ āĻŦ⧟āϏ 20), not the attribute itself.

  • Relationship (āĻĒāĻžāϰāĻ¸ā§āĻĒāϰāĻŋāĻ• āϏāĻŽā§āĻĒāĻ°ā§āĻ•):

  • An association (āϝ⧋āĻ—āϏ⧂āĻ¤ā§āϰ) connecting two or more entities. In a relational database, this is implemented using Foreign Keys (āĻĢāϰ⧇āύ āĻ•āĻŋ) to establish logical references between different tables.