ER Model Overview
Modeling Process
Read aloud is unavailable in this browser.
From Chaos to Structure: The Art of ER Modeling
Requirements arrive in messy forms: interview transcripts, spreadsheets, legacy system exports, whiteboard photos, and conflicting stakeholder opinions. Your task as a database designer is to transform this chaos into a precise, validated ER diagram that captures the essence of the domain.
This transformation isn't magic—it's a disciplined process that experienced designers follow. The process is iterative, collaborative, and guided by proven heuristics. Whether you're modeling a simple application or a complex enterprise system, the same fundamental steps apply.
This page teaches you the complete ER modeling methodology—from the first stakeholder interview to the final validated diagram. You'll learn not just what to do, but how to think about the modeling task.
By the end of this page, you will master a systematic process for ER modeling: gathering requirements, identifying entities through linguistic analysis, discovering relationships, assigning attributes, specifying constraints, iterating through refinement cycles, and validating with stakeholders.
Phase 1: Requirements Gathering
Before drawing a single shape, you must understand the domain. ER modeling is fundamentally a communication exercise—you're capturing someone else's mental model of their data. The better you understand their world, the more accurate your model will be.
- •Stakeholder interviews: Talk to people who will use the system. Ask them to describe their work, their data, their processes. Let them use their own vocabulary.
- •Existing documentation: Business process documents, policy manuals, forms, reports. These contain implicit data structures waiting to be uncovered.
- •Sample data: Real examples of invoices, customer records, inventory lists. Concrete examples reveal patterns that abstract discussions miss.
- •Legacy systems: Existing databases, spreadsheets, or paper systems. Even flawed systems capture organizational knowledge.
- •Use case scenarios: Walk through typical tasks. 'What happens when a customer places an order? What information do you need?' reveals entities and relationships.
- •Exception scenarios: Ask about edge cases and unusual situations. These often reveal subtle entity distinctions or constraint requirements.
Critical interviewing questions:
Effective requirements gathering uses specific question types:
Definitional questions: 'What is a [term]? How would you define it?'
- 'What exactly is a "product"? Is a service also a product?'
- 'When you say "customer," do you mean only people who have purchased, or also prospects?'
Relationship questions: 'How does [A] relate to [B]?'
- 'Can a customer have multiple addresses? Is there a primary address?'
- 'Can a product belong to multiple categories, or just one?'
Cardinality questions: 'How many [B] can one [A] have?'
- 'How many orders can a customer place?'
- 'Can an order span multiple shipments?'
Existence questions: 'Can [A] exist without [B]?'
- 'Can you have an order without a customer?'
- 'Can a product exist that has never been ordered?'
Identity questions: 'How do you uniquely identify a [A]?'
- 'What makes one order different from another?'
- 'How do you distinguish between two products with the same name?'
After gathering requirements, try explaining the domain to a 'rubber duck' (or uninvolved colleague). If you can't clearly explain what entities exist, how they relate, and what rules govern them, you need more requirements gathering. Your ER diagram should be a visual representation of this explanation.
Phase 2: Entity Identification
With requirements gathered, begin extracting entities—the major 'things' the system will track. The primary technique is linguistic analysis: systematically processing requirement statements to identify entity candidates.
| Heuristic | Description | Example |
|---|---|---|
| Noun extraction | Nouns and noun phrases often represent entities | 'Customers place orders for products' → Customer, Order, Product |
| Singular vs. plural | Convert plurals to singular—entities represent concepts, not collections | 'Products' → Product entity |
| Instance test | Ask: 'Can I have multiple instances of this? Does each have identity?' | 'Address' has multiple instances; 'System' usually doesn't |
| Independent existence | Ask: 'Does this exist independently or only in context of something else?' | 'LineItem' exists only within Order context |
| Stored vs. derived | Focus on stored data. 'Total' derived from line items isn't an entity | 'Customer' is stored; 'CustomerCount' is derived, not an entity |
| Domain relevance | Include only entities within project scope | HR system doesn't need Product entity from Sales |
Worked example—E-commerce requirements analysis:
Requirement statement: "Customers browse products organized into categories and subcategories. When ready, customers add products to a shopping cart and proceed to checkout. Each order is shipped to a delivery address and may be paid with credit cards stored on the customer's account. Customers can write reviews for products they have purchased."
Step 1—Extract nouns: Customers, products, categories, subcategories, shopping cart, checkout, order, delivery address, credit cards, account, reviews
Step 2—Apply entity tests:
| Noun | Multiple instances? | Independent? | Stored? | → Entity? |
|---|---|---|---|---|
| Customer | Yes | Yes | Yes | ✓ Entity |
| Product | Yes | Yes | Yes | ✓ Entity |
| Category | Yes | Yes | Yes | ✓ Entity |
| Subcategory | Yes | Depends on parent | Yes | ✓ Entity (possibly weak) |
| Shopping cart | Yes | Tied to customer | Maybe | ? (often session, not persisted) |
| Checkout | No—a process | No | No | ✗ Not an entity |
| Order | Yes | Yes | Yes | ✓ Entity |
| Delivery address | Yes | Tied to order/customer | Yes | ✓ Entity or attribute |
| Credit card | Yes | Tied to customer | Yes | ✓ Entity |
| Account | One per customer | Tied to customer | Maybe | ? (might merge with Customer) |
| Review | Yes | Yes | Yes | ✓ Entity |
Step 3—Refine entity list:
- Core entities: Customer, Product, Category, Order, Review
- Consider: CreditCard (entity for multiple per customer), Address (entity if shared/multiple), OrderLine (weak entity for products in order)
Don't confuse processes with entities ('Checkout', 'Login', 'Search'). Don't miss junction entities for M:N relationships. Don't over-abstract (creating 'Item' instead of distinct Product, Service types). Don't under-abstract (creating Customer, PremiumCustomer separately when inheritance applies). Validate each entity decision with domain experts.
Phase 3: Relationship Discovery
With entities identified, discover how they connect. Relationship discovery uses verb analysis and semantic reasoning to uncover associations between entities.
- •Verb extraction: Verbs and verb phrases often indicate relationships. 'Customer PLACES Order', 'Product BELONGS_TO Category', 'Review IS_WRITTEN_BY Customer'
- •Entity pairing: Systematically consider every pair of entities. 'Does Customer relate to Product? To Category? To Order?' This exhaustive approach catches non-obvious relationships
- •Stakeholder validation: Describe relationships in natural language to domain experts. 'Is it true that one Customer can place many Orders, and each Order belongs to one Customer?'
- •Document analysis: Forms and reports often show relationships implicitly. An invoice shows Order-Product relationship through line items
- •Process tracing: Walk through business processes. 'When shipping happens, which entities are involved?' reveals Shipment-Order-Address relationships
Systematically determining cardinality:
For each candidate relationship, answer these two questions:
- From A to B: 'For one instance of A, how many B can it relate to?'
- From B to A: 'For one instance of B, how many A can it relate to?'
The answers determine cardinality:
| A→B | B→A | Cardinality |
|---|---|---|
| One | One | 1:1 |
| One | Many | 1:N (from B's perspective) or N:1 (from A's) |
| Many | One | N:1 (from B's) or 1:N (from A's) |
| Many | Many | M:N |
E-commerce relationship analysis:
| Relationship | A→B | B→A | Cardinality |
|---|---|---|---|
| Customer PLACES Order | One customer places many orders | One order placed by one customer | 1:N |
| Order CONTAINS Product | One order contains many products | One product appears in many orders | M:N |
| Product BELONGS_TO Category | One product belongs to one category | One category contains many products | N:1 |
| Customer WRITES Review | One customer writes many reviews | One review written by one customer | 1:N |
| Review IS_FOR Product | One review is for one product | One product has many reviews | N:1 |
M:N relationships often indicate a missing junction entity. 'Order CONTAINS Product' (M:N) suggests OrderLine as an entity with its own attributes (Quantity, UnitPrice). When you find M:N, ask: 'Does this relationship have attributes? Is there information about the association itself?' If yes, create an explicit junction entity.
Determining participation constraints:
For each relationship, assess whether participation is mandatory or optional:
Mandatory (total) participation indicators:
- 'Every X must have a Y'
- 'An X cannot exist without a Y'
- 'All X are associated with Y'
Optional (partial) participation indicators:
- 'Some X may have Y'
- 'An X might not be associated with any Y'
- 'Not every X has a Y'
Example analysis:
| Relationship | Customer side | Order side |
|---|---|---|
| Customer PLACES Order | Optional (customer may exist without orders) | Mandatory (every order must have a customer) |
Note: This captures the business rule that you can have registered customers who haven't yet ordered, but you cannot have orphan orders.
Phase 4: Attribute Assignment
With entities and relationships defined, assign attributes to each. Attributes describe the properties we need to store about each entity (and sometimes about relationships).
- •Forms and documents: Paper forms explicitly list fields to capture. An order form shows OrderDate, CustomerName, ShippingAddress, ItemList, Total
- •Reports: Required outputs reveal necessary inputs. A 'Sales by Region' report requires Products to have Region (directly or through related entities)
- •Database queries: 'What questions must the system answer?' Each query implies data attributes. 'Find customers who haven't ordered in 6 months' requires LastOrderDate or derivable data
- •Business rules: Constraints imply attributes. 'Customers get 10% discount after $1000 lifetime spending' requires TotalLifetimeSpending attribute
- •Stakeholder interviews: Direct questions like 'What do you need to know about a Customer?' yield attribute lists
Important attribute decisions:
1. Identifying the key attribute(s):
Every entity needs one or more attributes that uniquely identify instances. Questions to ask:
- 'Is there a natural identifier?' (SSN for Person in US, ISBN for Book)
- 'Is a composite key needed?' (FirstName + Last Name + DateOfBirth)
- 'Should we create a surrogate key?' (Auto-generated CustomerID)
2. Simple vs. composite:
Should Address be one attribute or decomposed into Street, City, State, PostalCode, Country?
- Decompose if components are independently accessed or validated
- Keep simple if always treated as a unit
3. Derived vs. stored:
Age can be computed from DateOfBirth. OrderTotal can be computed from line items.
- Store if computation is expensive or historical values needed
- Derive if freshness is important and computation is cheap
- At conceptual level, note derived attributes but defer storage decision
4. Multivalued identification:
Can an entity have multiple values of an attribute? Customer may have multiple PhoneNumbers, multiple EmailAddresses.
- Mark as multivalued in conceptual model
- Will become separate tables or array types in implementation
| Entity | Key Attribute | Other Attributes | Notes |
|---|---|---|---|
| Customer | CustomerID | Name, Email, Phone*, RegisterDate |
|
| Product | ProductID | Name, Description, Price, SKU, Weight | Price may need history |
| Category | CategoryID | Name, Description, ParentCategory | ParentCategory enables hierarchy |
| Order | OrderID | OrderDate, Status, ShippingAddress, TotalAmount† | † TotalAmount is derived |
| OrderLine | OrderID + LineNumber | Quantity, UnitPrice | Weak entity of Order |
| Review | ReviewID | Rating, Text, ReviewDate | Also links to Customer, Product |
Relationships can have attributes too. In the ENROLLMENT relationship between Student and Course, attributes like Grade and EnrollmentDate describe the association, not either participant. These attributes appear on relationship diamonds in Chen notation or migrate to junction entities in crow's foot.
Phase 5: Constraint Specification
Beyond cardinality and participation, many business rules translate into constraints that the ER model should capture. These constraints ensure data integrity reflects real-world rules.
- •Key constraints: Attributes or attribute combinations that uniquely identify entities. Already captured as key attributes.
- •Domain constraints: Valid values for attributes. Email must match email format. Status must be from {Pending, Confirmed, Shipped, Delivered}. Age must be positive.
- •Cardinality constraints: Already captured as 1:1, 1:N, M:N ratios on relationships.
- •Participation constraints: Already captured as total/partial participation on relationships.
- •Structural constraints: Rules about entity structure. 'An Order must have at least one OrderLine.' 'A Manager must supervise at least 3 employees.'
- •Temporal constraints: Rules involving time. 'ShipDate must be after OrderDate.' 'An employee cannot have two overlapping positions.'
- •Referential integrity: Relationships that must maintain valid references. Captured implicitly by relationships; enforced explicitly in physical design.
Capturing constraints in ER diagrams:
Standard ER notation directly expresses some constraints (cardinality, participation, keys) but not others (domain constraints, complex business rules). For constraints beyond notation's expressiveness:
- Annotate the diagram: Add notes/comments near relevant entities or relationships
- Maintain a constraint document: A separate list of business rules keyed to entities/relationships
- Use min-max notation: More precise than simple 1/N; captures minimum constraints directly
Example constraint documentation:
Entity: Order
- OrderDate must not be in the future
- Status must be one of: Draft, Pending, Confirmed, Processing, Shipped, Delivered, Cancelled
- If Status = 'Shipped', ShippedDate must be non-null
- If Status = 'Delivered', DeliveredDate must be non-null and ≥ ShippedDate
Relationship: Order CONTAINS OrderLine
- Minimum cardinality on OrderLine side = 1 (order must have at least one line)
- If Order.Status ≠ 'Draft', OrderLines cannot be modified
Relationship: Customer PLACES Order
- A Customer cannot have more than 10 orders with Status = 'Pending' simultaneously
Many constraints cannot be captured in diagrams alone. Don't lose them! Maintain a parallel constraint specification document that accompanies your ER diagram. These constraints will drive CHECK constraints, triggers, and application logic in the physical implementation.
Phase 6: Diagram Construction
With all conceptual elements defined, construct the ER diagram. Diagram construction is partly mechanical (applying notation rules) and partly artistic (creating a readable, well-organized visual).
- •Start with core entities: Place the most central entities first. In e-commerce, Customer, Order, and Product form the core triangle.
- •Position related entities nearby: Entities with relationships should be visually proximate. Minimizes line crossing and aids comprehension.
- •Use consistent spacing: Equal distances between elements create visual order. Don't cram some areas while leaving others sparse.
- •Align elements when possible: Horizontal and vertical alignment creates a sense of structure. Avoid arbitrary diagonal placements.
- •Avoid line crossings: Crossing relationship lines create visual confusion. Rearrange entity positions to minimize crossings.
- •Use color thoughtfully: Color can group related entities (all HR entities in blue) but becomes problematic in black-and-white prints.
- •Maintain consistent notation: Stick to one notation style throughout. Don't mix Chen entity rectangles with crow's foot cardinality symbols unless the tool supports hybrid.
- •Include a legend: For shared diagrams, include a notation key explaining symbols used.
Layered construction approach:
Layer 1 – Entities only:
- Draw all entity rectangles
- Position for minimal future line crossing
- Verify entity naming consistency
Layer 2 – Relationships:
- Draw relationship connections
- Add relationship names
- Verify all expected relationships present
Layer 3 – Cardinality and participation:
- Add cardinality symbols/numbers
- Add participation indicators (double lines / mandatory symbols)
- Verify constraints match requirements
Layer 4 – Attributes:
- Add attribute ovals (Chen) or lists (crow's foot)
- Mark key attributes
- Mark derived/multivalued attributes
Layer 5 – Refinement:
- Adjust layouts for clarity
- Add any notes/annotations
- Verify completeness against requirements
Tools for ER diagram construction:
- Professional CASE tools: ERwin, Oracle SQL Developer Data Modeler, PowerDesigner
- Database design tools: MySQL Workbench, pgModeler, DbSchema
- General diagramming: Lucidchart, Draw.io, Microsoft Visio
- Quick/educational: dbdiagram.io, ERDPlus, QuickDBD
Large models become unreadable in a single diagram. Split into subject areas (Customer domain, Inventory domain, Fulfillment domain). Create an overview diagram showing entity boxes only (no attributes) with relationships, then detailed diagrams for each subject area. Always ensure navigability between diagrams.
Phase 7: Validation and Iteration
No ER diagram is correct on the first attempt. Validation catches errors before they become expensive implementation problems. Iteration incorporates feedback to refine the model.
- •Does every entity have a key attribute?
- •Does every relationship have a name?
- •Is cardinality specified for all relationships?
- •Is participation specified for all relationships?
- •Are all required attributes present?
- •Are derived attributes marked as such?
- •Are multivalued attributes identified?
- •Are weak entities correctly identified?
- •Are naming conventions consistent?
- •Do you recognize all these entities?
- •Are any important things missing?
- •Do the relationships correctly reflect reality?
- •Are the cardinalities correct?
- •Can you answer your key questions with this model?
- •Are there any rules this model violates?
- •Does the terminology match what you use?
- •Are there any exceptions not captured?
- •Would you explain your data this way?
Query validation—the ultimate test:
The most powerful validation technique is to test queries against the model. For each important question the system must answer, trace how you would retrieve the data:
Example query validation for e-commerce:
Query: 'Show all orders placed by customers who have written at least 5 reviews.'
Tracing:
- Start at Customer
- Follow Customer → Review relationship, count reviews per customer
- Filter customers with reviews ≥ 5
- Follow Customer → Order relationship
- Return those orders
✓ Model supports this query: Customer connects to both Review and Order.
Query: 'Show products that were both purchased and reviewed by the same customer.'
Tracing:
- Start at Customer
- Follow Customer → Order → OrderLine → Product
- Follow Customer → Review → Product
- Find intersection
✓ Model supports this query: Both paths from Customer to Product exist.
If any critical query cannot be traced through the model, something is missing—an entity, relationship, or attribute needs to be added.
Professional database designers expect 3-5 major iterations of an ER diagram before it stabilizes. Each stakeholder review, each query validation, each new requirement reveals refinements. Budget time for iteration—it's not wasted effort, it's where quality comes from.
Common iteration triggers:
- Missing entities: 'Oh, we also need to track Suppliers.' Add the entity and its relationships.
- Missing relationships: 'A Customer can have a preferred Store.' Add the relationship.
- Cardinality corrections: 'Actually, a Product can belong to multiple Categories.' Change 1:N to M:N.
- Attribute migration: 'Price changes over time; we need price history.' Price moves from attribute to related entity PriceHistory.
- Entity splits: 'Products and Services are different—they have different attributes.' Split Product into subtypes.
- Entity merges: 'BillingAddress and ShippingAddress are really the same thing.' Merge into Address entity.
- Constraint additions: 'An order can only be cancelled within 24 hours.' Add constraint documentation.
KEEP LEARNING
Keep learning for free.
Read the complete lesson, save your notes and pick up where you left off with a free account. No card needed.