ER Model, Entities, Relationships, Attributes, and Constraints
Design data conceptually by learning how to identify entities, attributes, relationships, keys, and business constraints before building tables.
Inside this chapter
- Why Conceptual Modeling Comes First
- Entities and Attributes
- Relationships and Cardinality
- Keys in Conceptual Design
- Constraints and Business Rules
- Real-World Example
Series navigation
Study the chapters in order for the clearest path from database fundamentals and SQL to transactions, indexing, recovery, distributed systems, tuning, and advanced DBMS engineering understanding. Use the navigation at the bottom to move smoothly across the full tutorial series.
Why Conceptual Modeling Comes First
Good databases are not designed by jumping directly into SQL tables. They begin with understanding the real-world domain. ER modeling helps students and teams represent business objects and relationships before implementation details are chosen.
Entities and Attributes
An entity represents a real-world object or concept such as Student, Course, Customer, Order, Doctor, or Invoice. Attributes describe properties of the entity such as name, phone, email, date of birth, or salary.
Student(student_id, name, email, date_of_birth)
Course(course_id, title, credits) Relationships and Cardinality
Relationships show how entities are connected. Cardinality describes how many instances of one entity relate to another.
- One-to-one
- One-to-many
- Many-to-many
For example, one department may have many employees, while a student may enroll in many courses and a course may contain many students.
Keys in Conceptual Design
Candidate keys, primary keys, and partial keys help identify entities uniquely. A well-chosen key simplifies later schema design and reduces ambiguity.
Constraints and Business Rules
A database is not only a storage mechanism. It is also a place where important rules are enforced. Examples include unique email addresses, valid enrollment rules, no negative account balances in certain contexts, or one seat being booked by one passenger at a time.
Real-World Example
In an online shopping system, entities may include Customer, Product, Cart, Order, Payment, and Shipment. Relationships show who purchased what, which order contains which items, and how payment and delivery are connected. ER modeling makes this structure understandable before implementation begins.