Free tutorials & notes in Hindi & English · Clean code examples 🧰 Free PDF & Image Tools →
MySQL + SQL · Lesson 22

ER Model in DBMS

In this lesson: ER model explained simply — entities, attributes, relationships, cardinality — with diagrams and examples for exams.

What is the ER model

The ER (Entity-Relationship) model is a way to plan a database before building it. You draw the real-world entities, their attributes, and the relationships between them. This diagram acts as a blueprint that you later turn into actual tables.

💡 ER model = entities (things) + attributes (their details) + relationships (how they connect).

Entities

An entity is a real-world thing you store data about — a Student, a Book, an Order. In diagrams it is drawn as a rectangle. Each entity usually becomes a table, and each specific instance (one student) becomes a row.

Attributes

Attributes are the properties of an entity. A Student entity might have roll, name and marks. In diagrams they are ovals attached to the entity. When you build tables, attributes become columns.

  • Key attribute — uniquely identifies the entity (like roll), underlined in diagrams.
  • Composite attribute — made of parts (like a full address).
  • Multivalued attribute — can have many values (like phone numbers).

Relationships

A relationship connects two entities. For example, a Student enrolls in a Course. In diagrams it is drawn as a diamond between the two entities. When turned into tables, relationships become foreign keys or a separate link table.

Cardinality

Cardinality tells you how many of one entity relate to another:

TypeMeaningExample
One-to-one1 relates to 1Person - Passport
One-to-many1 relates to manyDepartment - Students
Many-to-manyMany relate to manyStudents - Courses

Cardinality decides where foreign keys go, and whether you need a link table (for many-to-many).

From ER model to tables

  • Each entity becomes a table.
  • Each attribute becomes a column; the key attribute becomes the primary key.
  • A one-to-many relationship adds a foreign key on the "many" side.
  • A many-to-many relationship becomes a separate link table with two foreign keys.

This mapping is how a drawn ER diagram turns into a working relational database.

Common mistakes

  • Confusing entity and attribute. Entity is the thing; attributes are its details.
  • Missing the key attribute. Every entity needs one to become a primary key.
  • Ignoring cardinality. It decides foreign keys and link tables.
  • Forgetting many-to-many needs a link table. You cannot do it with a single foreign key.

Summary

  • The ER model is a blueprint of entities, attributes and relationships.
  • Entities are things (become tables); attributes are details (become columns).
  • Relationships connect entities (become foreign keys or link tables).
  • Cardinality is one-to-one, one-to-many, or many-to-many.
  • An ER diagram maps directly onto relational tables.

Next, learn the drawing symbols in ER diagram symbols, or see full examples in ER diagram examples.

Frequently Asked Questions

What is the ER model in DBMS?
The ER (Entity-Relationship) model is a way to design a database by drawing the real-world things (entities), their properties (attributes), and how they connect (relationships). It is a blueprint you create before making actual tables.
What is an entity in the ER model?
An entity is a real-world object or concept you store data about, like a Student, Book or Order. Each entity usually becomes a table, and each specific one (a particular student) becomes a row.
What is the difference between an entity and an attribute?
An entity is the "thing" (like Student), while attributes are its properties (like name, roll, marks). In a table, the entity is the table itself and the attributes are its columns.
What is a relationship in the ER model?
A relationship shows how two entities are connected, like a Student "enrolls in" a Course. Relationships become foreign keys or link tables when the ER model is turned into real tables.
What is cardinality in an ER model?
Cardinality describes how many of one entity relate to another: one-to-one, one-to-many, or many-to-many. For example, one department has many students (one-to-many), which affects how you design the tables.
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

Next topicER Diagram Examples for School Database Your progress: 22 / 151 (15%) · Lesson 23 / 151 Continue →

How was this lesson?

Your feedback helps us make the content better.

Write a review or suggestion (optional)

After approval, your name and city may appear publicly with your review. Please do not write your email or phone number.

▶ CodingEasily on YouTube

Learn with video lessons in easy Hindi

Featured video: RDBMS Part 3 – Class XI Commerce IT

▶ Subscribe – it’s free