Entity-Relationship Modeling

Learn to turn a written description of an organization's data into a clear database design. You identify entity types, attributes and keys, connect them with relationships and state how many instances can take part on each side. You draw the model in Chen notation and in crow's foot notation, handle weak entity types and superclass–subclass hierarchies, and translate the finished model into relational tables with primary keys, foreign keys and constraints. A complete library case and a review checklist show how the steps fit together.

IntermediateLesson 3 of 8 in Database Design and Advanced SQL Course

What you will learn

  1. Turn a written description of an organization's data into entity types with well-chosen attributes and keys, as the first step of conceptual database design.
    • Find the entities in a set of requirements
      Place ER modeling in the database design process, tell entity types from their instances, and pick out the things a database must keep data about.
    • Describe entities with attributes and keys
      Choose the right kind of attribute for each fact, allow for missing values, and give every strong entity type a key that identifies its instances.
  2. Connect entity types with relationships, state how many instances can take part on each side, and choose between the different ways to model the same facts.
    • Describe relationships, their degree and roles
      Name relationships between entity types, recognize binary, ternary and recursive relationships, and decide which facts belong to a relationship rather than to an entity.
    • State cardinality and participation
      Turn business rules into cardinality ratios and participation constraints, and express both together as minimum and maximum counts for each side of a relationship.
    • Choose between modeling alternatives
      Decide whether a fact is best modeled as an attribute, an entity or a relationship, place relationship attributes correctly, and turn a relationship into an entity when the requirements call for it.
  3. Draw a model in Chen notation and in crow's foot notation, read the cardinality and participation in each, and convert a diagram from one notation to the other.
    • Draw and read Chen notation
      Use rectangles, diamonds and ovals to show entity types, relationships and attributes, and read the cardinality and participation marks on the lines.
    • Draw and read crow's foot diagrams
      Read and draw entity boxes and relationship lines with crow's foot end marks, resolve many-to-many and ternary relationships with associative entities, and convert a Chen diagram into crow's foot form.
  4. Model entities that are identified through an owner, and organize entity types into superclasses and subclasses with the right constraints.
    • Model weak entity types
      Recognize entity types that cannot be identified on their own, link them to their owner through an identifying relationship, and choose their partial key.
    • Build specialization and generalization hierarchies
      Split an entity type into subclasses or combine similar entity types under a superclass, decide what each level inherits, and recognize when a subclass is worth adding.
    • Apply constraints on specialization
      State whether subclasses may overlap and whether every superclass instance must belong to one, and check sample instances against these constraints.
  5. Translate entity types, relationships, weak entity types and hierarchies into tables with primary keys, foreign keys and constraints that keep the model's rules.
    • Map entity types and their attributes
      Turn each strong entity type into a table, and map composite, multivalued and derived attributes into columns, extra tables or queries.
    • Map one-to-many and one-to-one relationships
      Place foreign keys on the correct side, turn participation into NULL and NOT NULL rules, and choose among the options for one-to-one and recursive relationships.
    • Map many-to-many relationships and weak entity types
      Build tables whose primary keys combine foreign keys: junction tables for many-to-many and higher-degree relationships, and tables for weak entity types.
    • Map specialization and generalization
      Compare the four standard ways to store a superclass and its subclasses in tables, and choose one that fits the hierarchy's constraints and use.
  6. Carry a realistic case from written requirements to a diagram and a set of tables, and review the result for missing facts, traps and rules that need extra constraints.
    • Go from requirements to a schema
      Apply every step to one case: find the entity types and keys, add the relationships with their constraints, recognize the weak entity type, and map the model to tables.
    • Review a model for traps and quality
      Check a model against its requirements with a checklist and sample data, find fan traps and chasm traps, and record the rules the diagram cannot show.

Entity-Relationship Modeling study guide

6 chapters

1

Entities, attributes, and keys

A database design starts with the things an organization needs to remember. Before choosing columns or writing SQL, you need clear names for those things, the facts that describe them, and rules that distinguish one instance from another. A training center provides a small example: courses, trainers, and participants each need an identity, while a score describes a particular enrollment. These choices give the rest of the model a dependable base.

1.1 Finding the things to model

A useful entity-relationship model starts with requirements: what must the organization remember, and what questions must the data answer? Read for meaning before drawing boxes. A noun is a clue, not a decision.

Where the ER model fits

Design usually moves through requirements, conceptual design, logical design, and physical design. Requirements describe the needed facts and rules. Conceptual design organizes those facts as entities, attributes, and relationships. Logical design turns that model into tables and constraints. Physical design chooses storage details such as indexes.

At the conceptual stage, you can discuss a student's identity without choosing an integer column, or a course's participants without deciding how to join tables. This keeps the conversation focused on the domain while its meaning is still being settled.

Types and instances

An entity is something distinguishable about which data is kept. It might be a person, an object, an event, or a concept. An entity type is the category, such as Student. An instance is one particular student, such as Amira Haddad, student number 20417. Some books use “entity set” for the category.

Use singular names: Student, Course, and Department. Mathematics Department and History Department are instances of Department, not separate types. Keep a name's meaning consistent; if Customer can mean either a person or an organization, settle how those cases are represented.

Work through the requirements

Consider: “A training center runs courses. Each course has a code, a title, and credits. Trainers teach courses. Participants enroll and receive a score.”

  1. Mark the nouns and noun phrases: training center, course, code, title, credits, trainer, participant, and score.
  2. Merge any synonyms. “Learner” and “participant” might describe the same type.
  3. Separate things from their properties. Course is a type; code, title, and credits describe it. Trainer and Participant also have identities and facts of their own.
  4. Locate facts about links. A score describes a participant's enrollment in one course.

The training center itself needs a type if its address, branches, or relationships must be recorded. A type can have just one instance. The question is whether the database needs facts about it, not whether many examples already exist.

Let the required facts guide the choice

A department name can be an Employee attribute when the name is all that matters. If each department also has a budget and a manager, give Department its own type. The department now has facts and relationships that should be recorded once and linked to employees.

A screen or report usually presents stored facts. A monthly sales report produced from Sale and Product data does not need a separate entity type merely because a user opens it. If the business stores individual issued reports as records with their own identifiers and dates, those are a different requirement.

Finally, turn gaps into concrete questions. “Trainers teach courses” leaves open whether a course can have several trainers. Ask whether two trainers may share one course and whether an unassigned course may exist. Those answers determine the relationships later.

Key Takeaways

  • An entity type names a category; an instance is one member of it.
  • Conceptual design describes data and links before logical design chooses tables.
  • Choose entity types from the facts and relationships the organization needs to keep.
  • Use singular, consistent names and resolve unclear requirements with domain experts.

1.2 Attributes and reliable identifiers

Once the entity types are clear, decide which facts describe each one. An attribute takes values from a domain: dates for date of birth, whole numbers from 1 to 30 for credits, or text up to 100 characters for a course title. The domain describes valid values, not just the values currently in the database.

Choose the attribute's form

A simple attribute is treated as one value. A composite attribute has useful parts. Address can contain street, postal code, and city; separate the parts when users need them separately, such as finding members in one city.

A single-valued attribute has one value per instance. A multivalued attribute allows several, such as a member's mobile and work phone numbers. Fixed fields named phone1, phone2, and phone3 impose an arbitrary limit and leave empty slots. Model the set of phone numbers directly; its table mapping will allow one row per value.

Stored facts are entered directly. Derived attributes are calculated from other facts. Date of birth is stored; age depends on it and today's date. A person born on 2000-03-15 is 26 on 2026-10-29. Counting enrollments gives a course's participant count. Storing a current age without updating it would make it stale.

A missing or inapplicable value becomes NULL in the table design. A member might have no middle name, or a return date might be unknown because a loan is still open. When an entire group needs different attributes, such as hourly staff needing an hourly rate, consider a subclass.

Identify each instance

A key is an attribute or group of attributes that uniquely identifies an instance. A candidate key is minimal: removing any part loses uniqueness. If student number alone is unique, the pair of student number and last name is unique too, but it is not minimal. Choose one candidate as the primary key; preserve the others as alternate candidate keys.

A composite key needs several attributes together. A scheduled flight can use flight number and date: AB 123 runs on many dates, and many flights run on 2026-11-02, but the pair identifies the scheduled flight in this model.

Key choiceMeaningDesign concern
Natural keyComes from the domain, such as an ISBNCheck uniqueness, presence, and stability
Surrogate keyGenerated solely for identification, such as member_idKeep any domain uniqueness rules separately

An email address is a candidate key only when every instance must have one and no two may share it. Household members may share an address, and addresses can change. A person's name is also a poor identifier because different people can have the same name.

Test the rule, not just the sample

Suppose ten members currently have different names. That sample fits a unique-name constraint, but a later member could have an existing name. A candidate key must distinguish every allowed instance, including future ones. Establish uniqueness from the business rules, then test whether the proposed key has any unnecessary parts. Favor a primary key that stays stable when descriptive facts change.

Key Takeaways

  • An attribute domain states which values are valid.
  • Composite attributes have useful parts; multivalued attributes have several values per instance.
  • Derive current values such as age from stored facts when they are needed.
  • A candidate key is unique and minimal; one candidate becomes the primary key.
  • A surrogate identifier does not replace a separate business uniqueness rule.
  • Choose keys from the domain rules, not from a small sample.
2

Relationships and business rules

Knowing the entity types is only the beginning: a design must also say which instances are connected. A relationship can carry its own facts, limit how many partners each instance has, and require or allow participation. Work from sentences about the domain, including whether the database keeps history. Then choose a representation that can preserve each required link, especially when an event repeats or a fact needs three participants together.

A relationship type describes an association, such as “Participant enrolls in Course.” A relationship instance links particular entities: Amira and Databases. Use a verb phrase for the name so that the connection reads as a meaningful sentence.

How many participants does the fact need?

The degree describes the relationship's structure. A binary relationship links two entity types, such as Trainer and Course. A ternary relationship links three. A recursive relationship links an entity type to itself.

In “Employee supervises Employee,” the two occurrences have different roles: supervisor and supervisee. A role tells you which job an instance plays in that relationship. Draw both connections to the same Employee type and label the roles. Do not create separate Supervisor and Supervisee types merely to show the two positions.

The same entity types can have several relationships. Employee “works in” Department and Employee “manages” Department record different facts. Knowing where an employee works does not identify the department they manage unless a separate rule connects those facts.

Put facts on the right link

A relationship can have attributes. Amira scores 85 in Databases and 70 in Statistics. The score is not a fact about Amira alone because it changes with the course. It is not a fact about Databases alone because different participants receive different scores. It belongs to the enrollment link.

A useful test is to hold one participant fixed and change the other. If the fact can change, the first entity alone does not determine it. Repeat the test in the opposite direction. In a many-to-many enrollment relationship, the participant–course pair identifies the score.

Keep three-way facts together

Consider “Supplier supplies Part to Project.” The instance linking Northline, M8 bolt, and Bridge Renewal carries quantity 400. All three are needed to identify what the quantity describes.

Replacing this with three pairwise relationships loses the complete fact. The pairwise data might say:

  • Northline supplies M8 bolts to some project.
  • Northline supplies some part to Bridge Renewal.
  • Bridge Renewal uses M8 bolts.

Those statements leave open whether Northline supplied the bolts used in Bridge Renewal. A different supplier could have supplied them, while Northline supplied another part to that project. A ternary Supply relationship preserves the actual triple.

Use binary relationships when the pairs are independent facts. Use a ternary relationship when the requirement needs one joint fact about all three. Counting nouns in a sentence cannot decide this: the meaning of the stored association does.

Separate stored links from activities

“The manager prints the attendance report” describes a workflow. It requires a relationship only if the database must remember which manager printed which report. A relationship line commits the model to storing an association, so add it for a required data fact, not every action mentioned during an interview.

Key Takeaways

  • Relationship names describe stored associations with verb phrases.
  • Role names distinguish the participants in a recursive relationship.
  • A relationship attribute describes the link, such as a score for one enrollment.
  • A ternary fact can lose information when replaced by independent pairs.

2.2 Minimum and maximum participation

For each relationship, ask two questions in both directions: how many partners can one instance have at most, and how many must it have at least? Keeping the questions separate prevents “one” from silently becoming “exactly one.”

Find the maximum in both directions

For one Department, how many Employees are allowed? Many. For one Employee, how many Departments are allowed? One. The maximum ratio is 1:N from Department to Employee.

If both answers are one, the ratio is 1:1. If both are many, it is M:N. Participant–Course enrollment is M:N when a participant can enroll in several courses and each course can have several participants. An Employee–Department management link is 1:1 when each department has one manager and each employee manages at most one department.

These are rules about allowed database states. A department with one employee today can still belong to a 1:N relationship. Empty departments and departments with many employees must also be considered if the rules permit them.

Add the minimum

Total participation means every instance must take part at least once. Partial participation means an instance may have no link. If every employee must belong to a department, Employee participates totally. If a department can be created before employees are assigned, Department participates partially.

Combine the two questions in a (minimum, maximum) pair:

Starting instanceNumber of partnersPair for that instance
One EmployeeExactly one Department(1, 1)
One DepartmentZero or many Employees(0, N)

Here each pair describes the participation of the named starting instance. A minimum can exceed one: “Every project needs at least two members” has minimum 2. Basic notation marks for zero and one need a written rule for that larger minimum.

Work through loans

A library keeps loan history. Each Loan belongs to exactly one Member and concerns exactly one Copy. A Member can have zero or many Loans over time; a Copy can also have zero or many Loans over time. Thus the two relationships are Member 1:N Loan and Copy 1:N Loan, with total participation for Loan in each.

The copy may be on at most one open loan now while having many past loans. These statements concern different time scopes. A current-state model and a history model can need different relationships and identifiers.

Check rules with evidence

Sample data can expose a violation: an employee recorded in two departments contradicts a maximum of one. A sample in which everyone has one department leaves open whether the business would permit two. Confirm the allowed maximum with someone who knows the domain.

The maximum later helps choose the table structure: a foreign key can record one partner, while many-to-many links need a junction table. The minimum helps choose whether a foreign key can be NULL. A rule requiring every parent to have a child needs a further check; filling each child's foreign key does not create a child for every parent.

Key Takeaways

  • Ask minimum and maximum questions in both directions.
  • Cardinality ratios describe allowed maxima, not current row counts.
  • Total participation requires a link; partial participation permits none.
  • A pair beside a starting entity can state its own minimum and maximum participation.
  • Choose the time scope before deciding how many partners are possible.

2.3 Choosing a representation that keeps the facts

An attribute, a relationship, and an entity type can sometimes represent similar information. Choose by asking what must have its own identity, details, or connections. The best choice lets every required fact be recorded without duplicating its meaning.

When a property needs its own entity

A member's phone numbers can be a multivalued attribute. If each number also needs a type, such as mobile or work, and permission to receive text messages, a Phone entity makes those details easier to attach. A simple department name can stay an attribute until the database needs Department's own budget, manager, or independent list of departments.

The number of words in the name does not decide the choice. The data the organization needs about the concept does. Give it an entity type when it has facts or relationships of its own.

When a link becomes an entity

A basic “Employee works in Department” relationship identifies which instances are linked. An associative entity gives a link its own box and attributes. Enrollment can connect Participant to Course and hold score. It replaces one M:N connection with two 1:N connections: each enrollment belongs to one participant and one course.

An event also needs its own identity when the same participants can be linked repeatedly. A member can borrow the same copy, return it, and borrow it again. A simple Member–Copy pair records only one link for that pair. Give each Loan a loan_id, or choose an event identifier that includes an appropriate date or occurrence value. The dates then describe one specific loan.

Put an attribute where its value is determined

For a current 1:N “works in” relationship, each Employee has at most one Department. The start date of that assignment can sit with Employee because each employee has only one current link. If the model starts keeping assignment history, several start dates may be needed; the event records then need separate identities.

An enrollment score cannot move into Participant, because one participant has a different score in each course. It also cannot move into Course, because each course has many participants with their own scores. Keep it on Enrollment or on the M:N relationship.

Avoid recording the same connection twice

In a conceptual model, the “works in” relationship already records Employee's Department. Adding department_id as an ordinary Employee attribute repeats that association. The attribute and the line could disagree. During logical mapping, the relationship becomes the foreign key; that is the point at which department_id belongs in the table.

Relationships can also duplicate each other. If every Course belongs to one Department and every Department belongs to one Faculty, the course's faculty follows from that chain. A direct Course–Faculty link adds nothing unless the business allows a course's faculty to differ. When two routes appear to answer the same question, check whether they really describe the same fact before keeping both.

Key Takeaways

  • Promote a property to an entity when it needs its own details or relationships.
  • An associative entity gives a relationship a place for its attributes and further links.
  • Repeated events need an identifier that distinguishes occurrences.
  • A conceptual relationship becomes a foreign key during logical mapping; avoid drawing the same link twice.
3

Reading and drawing ER diagrams

A diagram carries business rules through its shapes and marks. Chen notation makes entities, relationships, and attributes visually distinct; crow’s foot notation puts attributes inside boxes and combines minimum and maximum marks at line ends. You will read the same rules in both styles and convert between them. Pay special attention to where a mark belongs: a mark beside one box can describe the partners reached from the other box.

3.1 Chen shapes and constraint marks

Chen notation, introduced by Peter Chen in 1976, gives each kind of concept a distinct shape. Entity types are rectangles, relationships are diamonds, and attributes are ovals. Lines connect attributes to their entity or relationship and connect each relationship diamond to its participating types.

Read the attributes

An underlined attribute name marks a key. A composite attribute has ovals for its parts attached to its oval. A double oval marks a multivalued attribute; a dashed oval marks a derived attribute. An attribute belonging to a relationship attaches to the diamond.

For example, put trainer_id, name, and email in ovals attached to TRAINER, with trainer_id underlined. COURSE has code, title, and credits, with code underlined. PARTICIPANT and COURSE connect to ENROLLS; score hangs from that diamond because it describes an enrollment.

Ratio labels are read across the relationship

The schematic below names the shapes: uppercase names in square boxes represent rectangles, and the diamond marks the relationship.

[DEPARTMENT] --1-- <EMPLOYS> --N-- [EMPLOYEE]

The N beside EMPLOYEE means that one department can employ many employees. The 1 beside DEPARTMENT means that one employee works in at most one department. These labels describe maximum cardinality; they leave the minima to participation marks.

A double line between EMPLOYEE and EMPLOYS means total participation: every employee must have a department. A single line between DEPARTMENT and EMPLOYS allows a department with no employees. Double lines concern the entity at that end, so read participation separately from the ratio labels.

Minimum–maximum pairs use another direction

A different Chen style replaces ratio labels and participation lines with pairs:

[EMPLOYEE] --(1, 1)-- <EMPLOYS> --(0, N)-- [DEPARTMENT]

Here the pair beside EMPLOYEE states how many EMPLOYS instances each employee participates in: exactly one. The pair beside DEPARTMENT states how many each department participates in: zero or many. Some diagrams write 1..1 and 0..*.

The many-valued ratio label sits beside EMPLOYEE, but the many-valued participation pair sits beside DEPARTMENT. That reversal is a frequent reading error. Establish the diagram's convention before interpreting any marks; do not combine the two styles as if their labels had the same direction.

Arrows and recursive links

Some textbooks show maximum one with an arrowhead pointing toward an entity type. An arrow from EMPLOYS to DEPARTMENT means each employee has at most one department. A plain line allows many. The arrow alone does not require participation.

A recursive relationship has two lines from one diamond to the same rectangle. Label them with roles such as supervisor and supervisee so that “Employee supervises Employee” has a clear direction.

To build the training example, connect TRAINER to COURSE through TEACHES with 1 beside TRAINER and N beside COURSE. Draw COURSE's participation line double when every course needs a trainer. Then add the M:N ENROLLS relationship and its score oval. Each symbol now represents a separate fact about the model.

Key Takeaways

  • Chen uses rectangles for entity types, diamonds for relationships, and ovals for attributes.
  • A key is underlined; multivalued and derived attributes use double and dashed ovals.
  • Ratio labels are read across the relationship; a participation pair describes the adjacent entity’s own links.
  • A double participation line requires every instance at that end to take part.
  • An arrow toward an entity type means at most one partner of that type.
  • Label the roles on recursive relationship lines.

3.2 Crow’s foot end marks and conversion

Crow's foot notation, also called Information Engineering notation, draws each entity type as a box with its attributes inside. A labeled line represents a relationship. Logical diagrams commonly mark primary keys with PK and foreign keys with FK.

Read the far end

Each line end has two marks. The mark closest to the box gives the maximum: a bar means one and a three-pronged crow's foot means many. The farther mark gives the minimum: a circle means zero and a bar means one.

End marksNumber of partners
Circle and barZero or one
Two barsExactly one
Circle and crow's footZero or many
Bar and crow's footOne or many

Start at one box and read the marks at the other box. On a Department–Employee line, two bars beside Department mean that each employee has exactly one department. A circle and crow's foot beside Employee mean that each department has zero or many employees.

The marks beside Employee therefore describe how many employees a department can reach. Reading them as Employee's own participation reverses the rule. Say both complete sentences aloud while checking a diagram.

Turn a relationship into a box when needed

A conceptual M:N relationship can have crow's feet at both ends. A logical model resolves it into an associative entity. Enrollment holds the score and links to Participant and Course. Each Enrollment reaches exactly one Participant and exactly one Course; either participant type may reach many Enrollment instances.

A ternary Supply fact becomes a Supply box linked to Supplier, Part, and Project. Its quantity belongs inside Supply. Each Supply instance points to one instance of each participant. With optional participation for the participant types, the Supply ends of all three lines show zero or many.

Crow's foot has no universal symbols for all Chen attribute kinds. List a composite address as street, postal code, and city. Give a multivalued phone attribute a separate Member Phone box. Record the derivation of a calculated value in the diagram's notes or legend if the tool has no symbol for it.

Convert one relationship step by step

Start with Chen's DEPARTMENT–EMPLOYS–EMPLOYEE, ratio 1:N, with a double line at EMPLOYEE and a single line at DEPARTMENT.

  1. Replace the entity rectangles with boxes and move the attribute ovals inside.
  2. Replace EMPLOYS with a line labeled “employs.”
  3. Put exactly-one marks beside Department: every employee must have one department.
  4. Put zero-or-many marks beside Employee: a department may have no employees.

In common ASCII form this is:

DEPARTMENT ||--o{ EMPLOYEE : employs

The two bars are beside DEPARTMENT, and the circle plus opening crow's foot is beside EMPLOYEE. In many tools, solid lines mean identifying relationships and dashed lines mean non-identifying ones. Read the legend because tools vary. Conversion must preserve the business sentences even when the shapes and positions change.

Key Takeaways

  • Read crow’s foot marks at the opposite end from the starting instance.
  • The nearest mark gives the maximum and the farther mark gives the minimum.
  • An associative entity holds relationship attributes and resolves logical M:N or ternary links.
  • Convert the business rules, then place the marks; copying their positions can reverse the meaning.
  • Use the diagram legend for identifying lines and unsupported attribute symbols.
4

Weak entities and type hierarchies

Some instances borrow part of their identity from an owner; others are specialized forms of the same underlying instance. These are different modeling needs. Room numbers illustrate identification within an owner, while Person, Student, and Employee illustrate inherited identity and facts. You will distinguish those structures, show them in a diagram, and state independently whether subclass membership can overlap and whether every superclass instance must belong to a subclass.

4.1 Identity within an owner

A weak entity type cannot identify its instances with its own attributes alone. Its full identity combines an owner's key with a partial key that distinguishes instances belonging to that owner. A strong entity type already has a key of its own.

Build the identifier

Room numbers repeat across campus buildings. Room 101 in building A and room 101 in building B are different rooms. Building has key building_code; Room has partial key room_number. The room identifiers are the pairs (A, 101) and (B, 101).

The owner–weak link is an identifying relationship. It is usually 1:N from owner to weak entity, and the weak entity participates totally: a room in this model cannot exist without its building. An owner can still have no weak instances when the requirements allow it.

Order lines work the same way. Order 5001 has lines 1, 2, and 3; order 5002 has lines 1 and 2. The value 1 identifies a line only after an order has been chosen. Deleting order 5001 removes the meaning of its three lines, so the design deletes those lines with the order.

Draw identification explicitly

In Chen notation, draw Room as a double rectangle, the identifying relationship as a double diamond, and the partial key with a dashed underline. Use a double participation line from Room to the identifying relationship.

A solid underline would incorrectly claim that room number alone is globally unique. A single participation line would allow an ownerless room. In many crow's foot tools, a solid identifying line and an owner key included in the child's PK express the same identity; the legend establishes the line convention.

Dependency is different from weak identity

An Order may require a Customer and still be strong. If order_id is unique across the whole database, it identifies the order without the customer's identifier. The required customer link gives total participation, while weakness concerns how identity is formed.

You can give Room a surrogate room_id and make it strong. Keep the original rule with UNIQUE (building_code, room_number), and require both columns. Otherwise two room records could claim the same number in the same building despite having different generated IDs.

Follow nested ownership

A weak type can own another weak type. In a cinema chain, Hall is identified by Venue plus hall_number. Seat is identified by Hall plus seat_label. Expand the full identifier one level at a time:

  1. Venue: venue_id.
  2. Hall: (venue_id, hall_number).
  3. Seat: (venue_id, hall_number, seat_label).

Seat A7 in hall 2 of venue 9 differs from seat A7 in hall 2 of venue 10. Dropping any owner component would merge distinct locations. When mapping or referencing a weak entity, carry every component of this complete key.

Key Takeaways

  • A weak entity’s identity combines its owner’s key and its partial key.
  • The identifying relationship has total participation on the weak side.
  • A required owner link alone does not make an entity weak.
  • Adding a surrogate key still leaves the owner-relative uniqueness rule to enforce.
  • Nested weak identifiers include the full chain of owner keys.

4.2 Shared identity and inherited facts

A subclass is a specialized group within a superclass. Every Student is a Person. The Student and Person descriptions concern the same underlying instance, so the IS-A connection carries identity as well as membership.

Inherit the shared facts

Person has person_id, name, and date of birth. Student adds enrollment year and an enrollment relationship. Employee adds salary and a “works in” relationship. A student has all Person attributes plus the Student attributes, and inherits Person's relationships too.

Place each shared fact at the superclass level. Repeating name as an independently stored subclass attribute would allow two names for the same person. Attributes specific to a subclass stay with that subclass, where they apply to every member of that group.

An ordinary 1:1 relationship has a different meaning. A person can have one passport, but Person and Passport are distinct things. Student IS-A Person means the student is that person. Drawing it as a plain one-to-one link loses the shared-identity rule.

Work down or work up

Specialization starts with a broad type and splits out groups with their own facts or relationships. From Employee, identify Instructor with academic rank and Administrator with an office.

Generalization starts with similar types and finds their common base. Car and Truck may share registration number, make, and model year. Move those shared facts into Vehicle and keep the differences in Car and Truck. The result is the same kind of hierarchy, reached from the other direction.

A group name alone rarely needs a subclass. If the only difference is a label and all facts and links are identical, a type attribute can be enough. A pattern of inapplicable attributes can reveal a useful subclass: hourly rate belongs naturally to hourly staff when other employees do not have one. This is a design clue to check against the actual requirements.

More than one level or parent

Hierarchies can have several levels. A further subclass inherits through its ancestors. A lattice allows a subclass to have more than one superclass: Teaching Assistant can be both Student and Employee and inherit from both.

The shared subclass must keep the same underlying Person identity along both paths. It does not represent one unrelated student joined to one unrelated employee. The purpose is to describe one instance that has both roles.

Show the structure clearly

An extended Chen style links the superclass to a small circle and the circle to subclass rectangles. Subclass-specific attributes attach to those rectangles. Other styles use hollow arrowheads pointing from subclasses to the superclass.

Crow's foot tools vary: some nest subtype boxes, while others use a subtype connector. Write the hierarchy's constraints beside it when needed. First make the IS-A meaning clear; then state whether members may occupy more than one subclass and whether the subclasses cover the entire superclass.

Key Takeaways

  • An IS-A link means the subclass instance is the same instance as its superclass.
  • Subclasses inherit superclass attributes and relationships.
  • Specialization works downward; generalization finds a shared superclass from below.
  • A lattice lets a shared subclass inherit from more than one superclass.

4.3 Overlap and completeness

A hierarchy needs two independent membership rules. Disjointness asks whether one instance can belong to several subclasses. Completeness asks whether every superclass instance must belong to at least one. Neither rule answers the other question.

Make the two decisions

Disjoint subclasses allow at most one membership. Overlapping subclasses allow several. Total specialization requires at least one membership; partial specialization allows none.

CombinationAllowed membership
Disjoint and totalExactly one subclass
Disjoint and partialOne subclass or none
Overlapping and totalOne or several subclasses
Overlapping and partialNone, one, or several subclasses

For accounts limited to Savings and Checking, disjoint and total means every account is exactly one of those two types. A Person hierarchy with Student and Employee can be overlapping and partial: a person may study, work, do both, or do neither.

Check concrete instances

Consider four people: Amira is a student, Bruno is an employee, Mei is both, and Lena is neither. Mei needs overlapping membership; Lena needs partial completeness. Under a disjoint-and-total rule, Mei violates disjointness and Lena violates completeness.

Testing the two cases separately helps diagnose a bad rule. If the database must accept Mei but reject Lena, choose overlapping and total. If it must reject Mei but accept Lena, choose disjoint and partial. Seeing only students and employees in a small current list does not establish that future “neither” cases are forbidden; the business rule must settle that.

Put constraints on the diagram

In extended Chen notation, the circle contains d for disjoint or o for overlapping. A double line from the superclass to the circle means total specialization; a single line means partial. A diagram with o and a single superclass line expresses the four-person example.

Other tools write the words directly. Keep both words visible because a single “optional” note can otherwise be mistaken for a statement about overlapping membership.

Decide how membership is assigned

An attribute-defined specialization uses a superclass attribute to determine membership. For example, account_type = 'SAVINGS' puts an account in Savings. One single-valued type code fits a disjoint classification because the row holds one value. A user-defined specialization records membership through user decisions instead of one defining attribute.

The rules also govern changes. Under total specialization, a new superclass instance must acquire a subclass membership. Removing its only membership without replacing it would break completeness. Removing the superclass instance removes it from every subclass because those memberships refer to the same instance. In an attribute-defined hierarchy, changing the defining value changes the membership. When translating the hierarchy to tables, preserve these rules explicitly; merely creating subclass tables does not enforce all of them.

Key Takeaways

  • Disjointness controls whether memberships may overlap.
  • Completeness controls whether zero memberships are allowed.
  • Total and overlapping are compatible: every instance belongs to at least one subclass and may belong to several.
  • An attribute-defined specialization derives membership from a defining value.
  • Changes must preserve both constraints, including when the last membership is removed.
5

Turning the model into tables

Logical mapping makes the model enforceable in a relational database. Entity identities become primary keys, links become foreign keys or junction tables, and attribute kinds determine whether a fact needs one column or several rows. You will map each relationship shape, carry complete weak keys into references, and compare four ways to store subclasses. At each step, check which business rules the chosen SQL constraints actually enforce.

5.1 Tables and attribute storage

Logical design translates a conceptual model into a relational schema. A strong entity type becomes a table, and each simple attribute becomes a column. The entity's chosen identifier becomes the table's primary key.

Preserve all candidate keys

Schema notation makes the design compact: course(code PK, title, credits) marks code as the primary key. FK → member marks a foreign key to Member. SQL then gives these labels enforceable meaning through PRIMARY KEY and REFERENCES.

An alternate candidate key must be both unique and present. If every trainer has a distinct work email, declare email NOT NULL UNIQUE. A uniqueness constraint alone is insufficient to require an address. In the library model, members may share an email, so email is an ordinary attribute with no uniqueness constraint.

A composite address contributes its simple parts, such as street, postal_code, and city. The containing attribute name disappears from the table. This allows a city search without parsing a complete address string.

Give each repeated value a row

A multivalued phone attribute becomes member_phone(member_id PK FK → member, phone PK). The pair identifies each value belonging to one owner. Two phone numbers give two rows; no phone numbers give no rows.

CREATE TABLE member (
  member_id INTEGER PRIMARY KEY,
  first_name VARCHAR(50) NOT NULL,
  last_name VARCHAR(50) NOT NULL,
  email VARCHAR(254),
  street VARCHAR(100),
  postal_code VARCHAR(10),
  city VARCHAR(60),
  date_of_birth DATE
);

CREATE TABLE member_phone (
  member_id INTEGER REFERENCES member (member_id),
  phone VARCHAR(20),
  PRIMARY KEY (member_id, phone)
);

The composite primary key makes both phone-table columns non-null and prevents a member–phone pair from being repeated. It still permits the same phone number to appear for different members because phone alone is not unique. A comma-separated list in one column would not give each value its own constraint or reference.

Decide whether to store a derived value

Age has no column here: compute it from date of birth and the current date. Likewise, count enrollments when a course's participant count is needed. A view or query can present the result alongside stored facts.

A historical snapshot has a different purpose. An order's charged price preserves the value agreed at that time, even if the current product price changes. A stored current count, kept because computing it repeatedly is too slow, must change whenever its inputs change. Do not update a historical snapshot as though it were a current cached value.

Map in a practical order

Start with strong types, then weak types, binary relationships, higher-degree relationships, multivalued attributes, and hierarchies. Add foreign keys after their referenced tables exist. When references form a cycle, create the tables and add constraints in stages as needed. The final schema should show each stored fact's columns, every candidate key, and each link's full referenced key.

Key Takeaways

  • Strong entity types become tables and simple attributes become columns.
  • Alternate candidate keys need NOT NULL as well as uniqueness.
  • Composite attributes contribute their simple parts; multivalued attributes get separate rows.
  • Compute derived current values unless a deliberate storage choice requires them.
  • Historical snapshots stay fixed; stored current results must track their inputs.

A foreign key stores a reference to one related row. Its position and constraints must match both the relationship's maximum and its minimum. A reference that finds a real parent still needs separate rules about whether it can be missing or repeated.

Put a 1:N reference on the many side

For Department 1:N Employee, put department_id in Employee. Many employee rows can repeat the same department identifier. Putting one employee_id in Department would provide space for only one employee.

If every employee needs a department, make the foreign key NOT NULL. If unassigned employees are allowed, permit NULL. A start date belonging to the current assignment goes beside the foreign key on Employee.

CREATE TABLE employee (
  employee_id INTEGER PRIMARY KEY,
  name VARCHAR(100) NOT NULL,
  department_id INTEGER NOT NULL
    REFERENCES department (department_id),
  start_date DATE,
  supervisor_id INTEGER REFERENCES employee (employee_id)
);

The supervisor reference maps a recursive 1:N relationship. Its role name distinguishes it from the employee's own key. It allows NULL so that a top manager can have no supervisor.

With employees 1–3 assigned to department 10 and employees 4–7 assigned to department 20, department 30 can still have no employees. A non-null department reference in every employee enforces Employee's total participation. It does not enforce total participation for Department. Requiring every department to have an employee needs another mechanism that checks child existence.

Limit a 1:1 reference with uniqueness

Suppose every department has exactly one manager and an employee manages at most one department. Use department(department_id PK, name, manager_id FK → employee NOT NULL UNIQUE, manager_since).

REFERENCES checks that the manager exists. NOT NULL requires every department to name one. UNIQUE prevents the same employee from managing two departments. Without uniqueness, several departments could name the same manager, making the relationship 1:N.

Two other designs are useful:

  • Merge the types when both participate totally and are created together, such as an account and its settings.
  • Use a cross-reference table when both sides are optional and few are linked. Make each participant key individually unique in that table.

A combined primary key on the cross-reference pair only stops duplicate pairs; it does not stop either participant appearing in several different pairs.

Handle required circular references

If Department requires manager_id and Employee requires department_id, the first department and first employee cannot each be inserted alone with immediate checks. A supported deferrable foreign key can be checked after both rows exist at transaction end. Another design permits a temporary null reference and fills it in later, but then the final business rule needs its own enforcement. Making a column nullable changes what the schema permits; it is not itself a complete implementation of mandatory participation.

Key Takeaways

  • For 1:N, put the foreign key and link attributes on the many side.
  • Use NOT NULL for mandatory participation of the referencing row.
  • A foreign key does not require every referenced row to have a child.
  • A 1:1 foreign key also needs UNIQUE.
  • A recursive 1:N link is a role-named reference to the same table.
  • Plan how required circular references are created and checked.

5.3 Junction tables and complete weak keys

Many-to-many relationships need a row for each link. Weak entity types need a row whose identity contains its owner's key. Both often use composite primary keys, but the keys express different facts: one identifies an association and the other identifies an owned instance.

Map each enrollment link

Create enrollment(participant_id PK FK → participant, course_code PK FK → course, score). Amira takes Databases and Statistics; Bruno takes Databases; Mei takes Databases, Statistics, and Art. The two Amira links, one Bruno link, and three Mei links give six rows. Databases appears in three rows, one for each participant.

The primary key prevents the same participant–course pair from appearing twice. If results from repeated terms must be kept, extend the identifier to (participant_id, course_code, term). A surrogate enrollment_id is also possible, but keep a unique constraint on that business combination. Generated row IDs alone would allow duplicate enrollment facts with conflicting scores.

A recursive M:N relationship uses two role-named foreign keys to the same table: course_prerequisite(course_code PK FK → course, prerequisite_code PK FK → course). Reversing the columns changes which course requires which.

Keep a higher-degree fact in one row

Supply has foreign keys to Supplier, Part, and Project, with quantity as a link attribute. Usually the three participant keys form the primary key. If each project gets each part from exactly one supplier, (part_id, project_id) alone identifies the relationship row. Supplier stays a required foreign key but is omitted from the primary key.

Making all three columns the only uniqueness rule would then allow two suppliers for the same part–project pair. Choose the smallest key justified by the relationship's actual constraints.

Map weak identity

Room becomes room(building_code PK FK → building, room_number PK, capacity). The identifying relationship needs no separate table: the owner reference already represents it.

For an order line, combine the owner's key and the line number. The owner reference can use ON DELETE CASCADE when deleting an order must remove its lines:

CREATE TABLE order_line (
  order_id INTEGER REFERENCES customer_order (order_id)
    ON DELETE CASCADE,
  line_number INTEGER,
  product_id INTEGER NOT NULL REFERENCES product (product_id),
  quantity INTEGER NOT NULL CHECK (quantity > 0),
  PRIMARY KEY (order_id, line_number)
);

The table is named customer_order because ORDER is reserved in SQL. The primary key makes both identifying columns non-null. Without a delete action, the default NO ACTION prevents a referenced order from being deleted while its lines still reference it, subject to when the constraint is checked.

Reference the whole identifier

If another table refers to Room, its foreign key must combine building_code and room_number and reference that pair together. A room number alone can match several buildings. Separate checks on the two values would not establish that the particular combination exists. The same rule applies to every composite key, including nested weak identifiers.

Key Takeaways

  • An M:N link becomes a junction table containing participant foreign keys and link attributes.
  • A surrogate key still needs a uniqueness rule for the actual association.
  • Repeated occurrences need an additional identifying value.
  • A higher-degree relationship’s constraints determine which participant keys are needed in its primary key.
  • A weak table’s primary key combines the owner’s key and the partial key.
  • Reference composite identifiers with one foreign key over the complete combination.

5.4 Four ways to store subclasses

Consider Person with key person_id, name, and date of birth. Student adds enrollment year; Employee adds salary. The table mapping must preserve shared identity, allowed memberships, and any subclass-specific relationships.

Compare the four options
OptionTablesBest fit or limitation
A: Superclass plus subclassesPerson, Student, EmployeeSupports every constraint combination; full subclass records need joins
B: Subclasses onlyStudent and Employee, each with inherited columnsNeeds total coverage; overlap duplicates shared facts
C: One table with one typePerson with a type column and subclass columnsFits disjoint membership
D: One table with flagsPerson with one Boolean flag per subclassFits overlapping membership

The table layouts below use PK for primary key and FK for foreign key.

A:
  person(person_id PK, name, date_of_birth)
  student(person_id PK FK → person, enrollment_year)
  employee(person_id PK FK → person, salary)
B:
  student(person_id PK, name, date_of_birth, enrollment_year)
  employee(person_id PK, name, date_of_birth, salary)
C:
  person(person_id PK, name, date_of_birth, person_type,
         enrollment_year, salary)
D:
  person(person_id PK, name, date_of_birth, is_student,
         is_employee, enrollment_year, salary)

With A, each subclass uses person_id as both primary key and foreign key to Person. Person holds the shared facts once. Foreign keys ensure that subclass rows have superclass rows; total coverage and disjointness still need additional enforcement when required.

With B, each subclass row repeats name and date of birth. A person in neither subclass has nowhere to go, so the specialization must be total. Overlapping membership stores the same person in two tables, where shared values can disagree. Another table cannot refer to all people through one ordinary foreign key because the possible targets are split. An inherited outgoing reference, such as a department reference from each person, can still be repeated in each subclass table.

With C, one person_type value selects a subclass. Inapplicable subclass columns are NULL, and checks tie their use to the type. For example, salary must be null unless the type is Employee. A single type value cannot represent someone who belongs to both Student and Employee. A partial disjoint hierarchy also needs a representation for “neither.”

With D, is_student and is_employee can both be true. Require non-null flags and checks that keep subclass-only values consistent with membership. If the hierarchy is total, also require at least one flag to be true. Two false flags represent “neither” when the hierarchy is partial.

Follow the four-person example

Amira is a student, Bruno an employee, Mei both, and Lena neither. Option A gives four Person rows, two Student rows, and two Employee rows. Option B cannot store Lena and duplicates Mei's shared facts. Option C cannot express Mei's two memberships with one type. Option D gives four rows, with both flags true for Mei and both false for Lena.

Use the relationships to choose

With many subclass-specific attributes or links, A keeps each table focused. Employee's department foreign key goes in Employee, preventing a non-employee from acquiring that link; Mei can have one because she is an employee too.

With few subclass fields and frequent whole-population reads, C or D avoids joins but needs checks around nullable fields. B suits a disjoint, total hierarchy when work usually concerns one subclass at a time. In a one-table mapping, a department foreign key needs a membership check so that people outside Employee cannot use it.

Key Takeaways

  • Option A shares the superclass key with each subclass and supports all membership combinations.
  • Option B needs total coverage and duplicates inherited facts when memberships overlap.
  • Option C’s one type column fits disjoint membership; Option D’s flags allow overlap.
  • The table layout must be paired with constraints that enforce the hierarchy’s rules.
  • Keep subclass-specific relationships available only to members of that subclass.
6

Building and checking a complete design

A complete model has to work as a whole: its identifiers, relationship rules, and tables must support the questions people ask. The library case brings together multivalued attributes, a weak copy identifier, authorship links, and repeatable loan events. Then sample data and targeted review questions expose missing links and unenforced rules. A diagram can look tidy while still losing a fact, so the final test is whether the required data can be stored and retrieved correctly.

6.1 From library requirements to a schema

The library needs branches with names and addresses; books cataloged by ISBN, title, year, and authors; numbered copies kept at branches; and members with names, emails, and phone numbers. It keeps each loan's dates, including repeat loans of the same copy to the same member.

Choose identities and attributes

Use Branch, Member, Book, Author, Copy, and Loan. Give Branch, Member, Author, and Loan generated identifiers. Book uses ISBN. A copy number is unique only within a book, so Copy is weak with partial key copy_number and owner Book.

Split Branch's address into street, postal code, and city. Member's phone numbers are multivalued. Email is not a candidate key: the requirements do not guarantee distinct addresses for different members. Loan keeps loan date, due date, and return date; a still-open loan has a null return date.

A Loan needs an identity beyond the Member–Copy pair. Otherwise the same member's second borrowing would collide with the first and its dates could not be kept separately.

State every relationship in both directions

Each Book has one or more Authors, and each Author in this catalog has one or more Books: M:N. A Book has zero or many Copies; each Copy belongs to exactly one Book. A Branch holds zero or many Copies; each Copy is held by exactly one Branch. A Member has zero or many Loans and a Copy has zero or many Loans over time; each Loan has exactly one Member and one Copy.

One crow's foot rendering of the logical relationships is:

BOOK   ||--o{ COPY        : identifies
BRANCH ||--o{ COPY        : holds
MEMBER ||--o{ LOAN        : borrows
COPY   ||--o{ LOAN        : concerns
BOOK   ||--|{ BOOK_AUTHOR : has
AUTHOR ||--|{ BOOK_AUTHOR : writes
MEMBER ||--o{ MEMBER_PHONE : registers

Each end describes the partners reached from the opposite box. Book Author is the authorship link; Member Phone stores each registered phone value.

Produce the eight tables
  • branch(branch_id PK, name, street, postal_code, city)
  • member(member_id PK, name, email)
  • member_phone(member_id PK FK → member, phone PK)
  • book(isbn PK, title, publication_year)
  • author(author_id PK, name)
  • book_author(isbn PK FK → book, author_id PK FK → author)
  • copy(isbn PK FK → book, copy_number PK, branch_id FK → branch NOT NULL)
  • loan(loan_id PK, member_id FK → member NOT NULL, isbn NOT NULL, copy_number NOT NULL, loan_date, due_date, return_date)

Loan additionally needs one composite constraint: FOREIGN KEY (isbn, copy_number) REFERENCES copy (isbn, copy_number). It checks the particular copy, including its book, as a single reference.

Check the design with instances

“The Quiet River” has copies 1 and 2 at Central and copy 3 at Harbor. Member 12 borrowed copy 1 on 2026-10-01, due 2026-10-22, and returned it on 2026-10-20. Copy 2 was borrowed on 2026-10-20, is due on 2026-11-10, and has no return date. On 2026-10-29, copy 1 is available at Central; copy 2 still has an open loan.

Requiring every book to have an author needs a child-existence check beyond the foreign keys. Date ordering fits CHECK (return_date >= loan_date); it permits a null return date for an open loan. Requiring loan date to be present needs NOT NULL as well.

Key Takeaways

  • Book and Copy are different types; Copy’s identity includes Book’s ISBN.
  • A Loan identifier keeps repeat borrowings separate.
  • The library mapping has eight tables, including phone and authorship tables.
  • Loan references Copy with one composite foreign key.
  • Sample rows check whether the design can answer availability questions.
  • Author minimums and date rules need explicit enforcement beyond the relationship lines.

A review asks whether the model can keep every required fact and answer every required question. Check the requirements against the diagram, then check the diagram against the table constraints. A correct-looking line can still encode the wrong minimum, maximum, or time scope.

Read and test the model

For each strong type, find its key. For each weak type, find its owner and partial key. Check multivalued and derived attributes, consistent names, and relationships drawn twice as both attributes and lines.

Read every relationship aloud with both bounds: “Each copy is held by exactly one branch” and “Each branch holds zero or many copies.” Have someone who knows the domain confirm both sentences. A rejection identifies a particular rule to change.

Next, invent small sample instances and try the required actions. Can you create a branch with no copies? Can a member register two phone numbers? Can the same member borrow the same copy later? Test a valid boundary case as well as a normal one. Also try invalid cases, such as a loan referring to a nonexistent copy, and identify the exact constraint that rejects each one.

Recognize a fan trap

Suppose Faculty has 1:N links to both Department and Instructor. Two departments and three instructors can belong to the same faculty, but the model does not record which department employs each instructor. Joining through Faculty would pair each instructor with every department of that faculty.

The required connection is Department–Instructor. If each instructor belongs to one department and each department belongs to one faculty, use the chain Faculty 1:N Department 1:N Instructor. The faculty of an instructor then follows through the department. Keep a separate direct faculty link only if it records a genuinely different fact.

Recognize a chasm trap

A rental model links Branch to Employee and Employee to Car through “looks after.” Cars may have no assigned employee. A car without a caretaker then has no path to its branch, even though the business still needs to know where it is.

Add a direct Branch–Car relationship. Branch location and employee care are separate facts, so the cycle now has a reason. Making care mandatory would reject valid unassigned cars without recording their location independently.

Record rules beyond the diagram

An ER diagram does not express every business rule. “A member may have at most 10 copies on loan at once” counts open loans across rows; “the due date is 21 days after the loan date” compares values within a loan. Write both rules next to the model, then choose an enforcement mechanism for each.

Row-local value checks often fit CHECK. Rules that count other rows or require a parent to have children need a mechanism such as a trigger, transaction-level check, or application code. Check concurrent changes too: separate actions that each seem valid must not together break the same business limit.

Key Takeaways

  • Review requirements, diagram rules, and table constraints as separate checks.
  • A fan trap misses the needed connection between two branches of a relationship pattern.
  • A chasm trap loses a path when an optional intermediate link is absent.
  • A cycle is useful when its links record different facts.
  • Record and enforce business rules that relationship marks cannot express.

Entity-Relationship Modeling examples

6 Walkthroughs

1

Turn requirements into entities and keys

12 steps
Work through a training-center description, separate types from facts, and choose identifiers that survive changes.
  1. 1
    IntroductionStart with the data to remember

    A training center needs a record of its courses, trainers, and participants. It also needs to know who enrolls in which course and what score they receive.

    Build the conceptual model first: identify the things, their facts, and their links. Each kind of thing is an entity type; a candidate key identifies each instance even as data changes. Tables and SQL come later, once these meanings are clear enough to discuss with the people who use the data.

  2. 2
    ExampleMark the candidate things

    Read: “Each course has a code, a title, and credits. Trainers teach courses. Participants enroll and receive a score.”

    Course, Trainer, and Participant are candidate entity types. Code, title, and credits describe a course, so they are attributes. Score needs a closer look because it describes a participant in one particular course.

  3. 3
    ExplanationSeparate a type from one member

    Student names a category; Amira Haddad, student number 20417, is one instance. The same distinction applies to departments: Mathematics Department and History Department are two instances of Department.

    Use one singular name for each type. Creating a different type for every current department would confuse the category with the members it is meant to describe.

  4. 4
    ChallengeDoes this need an entity type?

    A center needs to store its own address and director, even though it has only one center. Should Center be modeled as an entity type?

    ---reveal---

    Yes. Center has facts that the database needs to keep. An entity type can have one instance; a count of one is not a reason to discard the concept.

  5. 5
    TipAsk what an unclear noun means

    If requirements use both “learner” and “participant,” check whether they mean the same thing. Merge synonyms before adding boxes.

    Also turn vague sentences into concrete questions. “Trainers teach courses” leaves open whether trainers can share a course. Ask about that possibility before selecting relationship constraints.

  6. 6
    ExplanationGive each fact a useful form

    An attribute domain states its valid values, such as dates or credits from 1 to 30. An address can be composite when street, postal code, and city need separate use.

    A member can have several phone numbers, making phones multivalued. The two distinctions answer different questions: parts within one value versus several values belonging to one instance.

  7. 7
    ExampleChoose stored facts and derived values

    Store date of birth and derive current age from it. A person born on 2000-03-15 is 26 on 2026-10-29; the same stored birth date supports a different age after the next birthday.

    A return date can be NULL while a loan is open. Null represents a missing or inapplicable value, not a second phone number or a value that should be calculated.

  8. 8
    ExplanationRequire a minimal identifier

    A candidate key uniquely identifies every instance and has no unnecessary parts. If student number alone is unique, the combination of student number and last name is not minimal.

    Choose one candidate as the primary key. A composite key is valid when its components are needed together, such as flight number and date for a scheduled flight.

  9. 9
    ChallengeCheck a proposed key

    A club gives each member a unique permanent number. Two members may share a name and email. Is (member number, email) a candidate key?

    ---reveal---

    No. Member number already gives uniqueness, so email is an unnecessary component. Email also cannot identify a member alone because sharing is allowed. The number is the minimal candidate here.

  10. 10
    Key InsightKeep identity stable

    A natural key comes from the domain, such as ISBN. A surrogate key is generated only for identification. Either must identify the intended instance reliably.

    An email can be a candidate only when every instance has one and sharing is forbidden. Even then it may change, which is a reason to choose a stable surrogate primary key and preserve email’s separate uniqueness rule.

  11. 11
    ChallengeCombine entity and key choices

    A learning center now records each department’s budget and manager. Department names can repeat across branches, but every department receives a globally unique department number. What should Department become, and what identifies it?

    ---reveal---

    Use a Department entity type with department number as its key. Its own facts justify the entity, and repeated names make name unsuitable as its identifier.

  12. 12
    RecapReview the first design decisions

    The model now distinguishes types from instances and properties from independent records. Each fact has a useful form: simple parts, multiple values, or a derivation.

    Check every proposed identifier against all allowed instances, not just the current sample. A unique and minimal candidate gives relationships a dependable way to point to the right instance.

2

Build relationships from business rules

14 steps
Place link attributes, establish both bounds, and preserve repeated events and joint facts.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionDecide what each link records
  2. 2
    ExampleAttach score to the enrollment
  3. 3
    ExplanationUse roles for a recursive link
  4. 4
    ExampleKeep a supply triple together
  5. 5
    ChallengeIdentify the complete fact
  6. 6
    ExampleAsk both maximum questions
  7. 7
    ExplanationCombine the bounds
  8. 8
    ChallengeTranslate a new rule
  9. 9
    TipSeparate current state from history
  10. 10
    ExampleGive repeated events identities
  11. 11
    ExplanationChoose when a property gets a box
  12. 12
    Key InsightStore each conceptual link once
  13. 13
    ChallengeExtend a current-assignment model
  14. 14
    RecapCheck meaning and both bounds
3

Convert a relationship between diagram styles

12 steps
Read Chen labels and crow’s foot marks by translating them into complete business sentences.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionKeep the rules while changing the drawing
  2. 2
    ExplanationRead Chen’s three shapes
  3. 3
    ExamplePlace ratio and participation marks
  4. 4
    Key InsightNotice the pair-style reversal
  5. 5
    ChallengeInterpret a participation pair
  6. 6
    TipCheck arrows and recursive roles
  7. 7
    ExplanationRead the destination end
  8. 8
    ExampleConvert the employee rule
  9. 9
    ChallengePlace the correct end marks
  10. 10
    ConnectionConvert a relationship with its own facts
  11. 11
    ChallengeConvert a weak identifier too
  12. 12
    RecapRead both sentences after conversion
4

Model owned identities and inherited roles

14 steps
Distinguish weak identity from dependency, then check a Person hierarchy’s inheritance and membership rules.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionSeparate two kinds of structure
  2. 2
    ExampleComplete the room identifier
  3. 3
    ExplanationDraw the identifying structure
  4. 4
    ChallengeIs dependency enough?
  5. 5
    Key InsightCarry nested owners into the key
  6. 6
    ExplanationA student is the same person
  7. 7
    ExampleWork down or work up
  8. 8
    ChallengeFollow two inheritance paths
  9. 9
    ExplanationAsk about both and neither
  10. 10
    ExampleTest four people
  11. 11
    ChallengeChoose the membership constraints
  12. 12
    ConnectionLet a value determine a subtype
  13. 13
    ChallengePreserve identity and valid membership
  14. 14
    RecapCheck identity before choosing symbols
5

Map the model and check its constraints

21 steps
Work through attribute storage, foreign-key placement, junctions, weak keys, and the four hierarchy mappings.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionMake the model’s rules enforceable
  2. 2
    ExampleStart with a member table
  3. 3
    ExampleGive phone values separate rows
  4. 4
    ChallengeKeep the right stored value
  5. 5
    ExamplePlace a one-to-many reference
  6. 6
    Key InsightCheck what the foreign key guarantees
  7. 7
    ExampleMap one-to-one with three checks
  8. 8
    ChallengeDiagnose a nearly correct mapping
  9. 9
    TipPlan self-references and cycles
  10. 10
    ExampleCreate one row per enrollment
  11. 11
    ExampleCount the actual relationship rows
  12. 12
    ChallengeKeep repeat terms without duplicates
  13. 13
    ExampleMap a three-way rule
  14. 14
    ExampleCarry a weak key into its table
  15. 15
    ChallengeValidate the whole target identity
  16. 16
    ExplanationShare a key across superclass tables
  17. 17
    ExampleCompare the other three layouts
  18. 18
    ChallengeChoose a layout for both and neither
  19. 19
    ExampleTrace four people through the tables
  20. 20
    ChallengeConnect mapping to membership enforcement
  21. 21
    RecapMatch each rule to its declaration
6

Build and review the library schema

14 steps
Follow one library case from identities to eight tables, then test retrieval paths and remaining business rules.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionFollow one complete library design
  2. 2
    ExampleDistinguish the book from its copies
  3. 3
    ExampleGive every loan its own identity
  4. 4
    ExplanationAdd the two extra value tables
  5. 5
    ChallengeReference a numbered copy
  6. 6
    ExampleTest availability with actual loans
  7. 7
    Key InsightFind the rules still missing
  8. 8
    TipReview in both directions
  9. 9
    ExampleFind a fan trap
  10. 10
    ChallengeRepair an incomplete path
  11. 11
    ExampleKeep a path for unassigned cars
  12. 12
    ChallengeChoose the right enforcement level
  13. 13
    ChallengeReview a changed copy design
  14. 14
    RecapFinish with facts and questions

Entity-Relationship Modeling practice questions

50 Practice Questions in 5 sets

Set 1: Identify entities and preserve their links10 Practice Questions

Question 1 of 10

A repair service stores each repair visit with its own number, date, and outcome. What does Repair Visit represent in the conceptual model?
  1. A composite attribute of Customer.
  2. An instance of the Technician type.
  3. An entity type for recorded events.
  4. A role played by the technician.
Show answerHide answer
Answer: C
Repair Visit is an entity type because each recorded event has an identity and facts of its own. An entity does not have to be a physical object. Treating the visit as one customer attribute would lose the separate identities and details of that customer’s visits.

Question 2 of 10

Every equipment item has a distinct asset tag. Tags never repeat; names can repeat. Why is (asset_tag, name) not a candidate key?
  1. The name is unnecessary for uniqueness.
  2. The pair cannot distinguish equipment items.
  3. A candidate key must have one attribute.
  4. The asset tag must be generated by SQL.
Show answerHide answer
Answer: A
A candidate key must be minimal as well as unique. Asset tag already identifies every item, so removing name from the pair preserves uniqueness. Composite candidate keys are valid when every component is needed; having two columns is not itself the problem.

Question 3 of 10

A consultancy records the hours that each specialist works on each assignment. A specialist can work on several assignments, and an assignment can have several specialists. Where do hours belong?
  1. On Specialist as one hours attribute.
  2. On Assignment as one hours attribute.
  3. On separate Specialist and Assignment attributes.
  4. On the Specialist–Assignment relationship.
Show answerHide answer
Answer: D
Hours describe one specialist’s work on one assignment, so they depend on the pair. A single Specialist hours value could not preserve different hours for several assignments. Putting one value on Assignment would likewise merge the contributions of its different specialists.

Question 4 of 10

Each shipment leaves exactly one warehouse. A warehouse can exist before handling any shipments and can later handle many. What are the shipment and warehouse participation pairs, respectively?
  1. Shipment (0, 1); Warehouse (1, N).
  2. Shipment (1, 1); Warehouse (0, N).
  3. Shipment (1, N); Warehouse (0, 1).
  4. Shipment (0, N); Warehouse (1, 1).
Show answerHide answer
Answer: B
Each shipment participates in exactly one warehouse link, giving (1, 1). A warehouse may have no shipments or many, giving (0, N). Reversing the pairs confuses a starting entity’s own participation with the number of partners reached from the opposite side.

Question 5 of 10

In a Chen diagram, which attribute symbol represents a set of registered phone numbers for one contact?
  1. A dashed oval.
  2. A double oval.
  3. An underlined oval.
  4. An oval with component ovals.
Show answerHide answer
Answer: B
A double oval marks a multivalued attribute, allowing one contact to have several phone numbers. A dashed oval instead marks a derived value, such as a count computed from other data. Several values of one attribute are different from meaningful parts of a composite attribute.

Question 6 of 10

A crow’s foot line has exactly-one marks beside Office and zero-or-many marks beside Desk. How many offices can one desk belong to?
  1. Zero or one office.
  2. One or many offices.
  3. Zero or many offices.
  4. Exactly one office.
Show answerHide answer
Answer: D
Start at Desk and read the marks at Office: exactly one. The zero-or-many marks beside Desk describe how many desks one office can have. Using the marks next to the starting box would reverse the reading direction and give the office’s rule instead of the desk’s.

Question 7 of 10

A shelf is numbered only within a storage room. Rooms have globally unique room IDs, but shelf numbers repeat in different rooms. What identifies a shelf?
  1. The room ID and shelf number together.
  2. The shelf number without the room ID.
  3. The room ID without the shelf number.
  4. The shelf number and its current contents.
Show answerHide answer
Answer: A
The room ID chooses the owner, and the shelf number distinguishes shelves within that room. Shelf number alone can refer to shelves in several rooms. Contents describe a shelf and may change; they are not part of the stated identification rule.

Question 8 of 10

A contact can register any number of email addresses. In the direct relational mapping, where are those values stored?
  1. In the Contact table with one fixed column per possible address.
  2. In the Contact table with one comma-separated address value.
  3. In a separate table with one address per contact–address row.
  4. In a separate table with one row containing all a contact’s addresses.
Show answerHide answer
Answer: C
A multivalued attribute maps to rows containing the owner key and one value. This permits any number of addresses and lets each value be constrained separately. Fixed email columns impose an arbitrary limit and leave empty slots for contacts with fewer addresses.

Question 9 of 10

Every parcel belongs to one delivery route, and a route can contain many parcels. How should the basic table reference be placed?
  1. A route_id foreign key belongs in Parcel.
  2. A parcel_id foreign key belongs in Route.
  3. Both keys belong in each table as primary keys.
  4. One route column is needed for each parcel.
Show answerHide answer
Answer: A
Parcel is the many side, so each parcel row stores its one route reference. Many parcel rows can repeat the same route ID. Placing one parcel ID in Route would give a route space for only one parcel and would fail as soon as that route had a second parcel.

Question 10 of 10

A museum numbers specimens within each collection. A specimen can be examined repeatedly by the same researcher, and all examination dates must be kept. What design preserves both identities?
  1. Specimen PK (specimen_no); Examination has its own ID and references that number.
  2. Specimen PK (collection_id, specimen_no); Examination PK (researcher_id, collection_id, specimen_no).
  3. Specimen PK (collection_id); Examination adds a date column to each researcher row.
  4. Specimen PK (collection_id, specimen_no); Examination has its own ID and references that pair.
Show answerHide answer
Answer: D
Specimen needs the collection key because specimen numbers repeat between collections. Examination also needs an occurrence identity so repeat examinations of the same specimen by the same researcher remain distinct. A key made only from researcher and specimen identifies a pair and would allow just one examination for it.
Set 2: Read constraints and choose table structures10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A vehicle record stores manufacture_date and an age computed for the day a report runs. What kind of attribute is that current age?
  1. A multivalued attribute.
  2. A derived attribute.
  3. A composite attribute.
  4. A stored attribute.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A registry changes from storing each machine’s current operator to keeping all operator assignments over time. Several operators may use a machine in different periods. Why can the machine now have many operator links?
  1. The current assignment has become optional.
  2. The machine identifier is no longer unique.
  3. The operator type has become a weak type.
  4. The model now keeps past assignment occurrences.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A parking operator stores vehicle registrations only as text on Permit. It must now record each vehicle’s make, inspection date, and permits, including vehicles without a permit. What change fits these needs?
  1. Create Vehicle and link each permit to its vehicle.
  2. Keep the text and add one inspection field per permit.
  3. Create a separate entity type for every vehicle make.
  4. Keep only Vehicle and discard the separate Permit records.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A Chen diagram uses (min, max) participation pairs. Beside Technician it shows (0, N), and beside Job it shows (1, 1). What does the Technician pair mean?
  1. One job can involve zero or many technicians.
  2. One technician must participate in exactly one job.
  3. One technician can participate in zero or many jobs.
  4. One job can involve at most one technician optionally.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

What does the statement “Volunteer IS-A Person” mean for one volunteer’s identity?
  1. The volunteer is linked to a separate person instance.
  2. The volunteer shares Person’s attributes but has a separate underlying identity.
  3. The volunteer belongs to every Person subclass.
  4. The volunteer is the same instance as a person.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Every registered participant must be a presenter or a reviewer, and a participant may be both. What specialization constraints apply?
  1. Disjoint and total.
  2. Overlapping and total.
  3. Overlapping and partial.
  4. Disjoint and partial.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

Each studio must name one existing resident as coordinator. A resident may coordinate at most one studio. Residents may exist without a studio role. What constraints on studio.coordinator_id implement these rules?
  1. FOREIGN KEY and NOT NULL, no UNIQUE.
  2. FOREIGN KEY and UNIQUE, no NOT NULL.
  3. FOREIGN KEY, NOT NULL, and UNIQUE.
  4. NOT NULL and UNIQUE, no FOREIGN KEY.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A lab records which analyst calibrates each sensor in each campaign. Each sensor–campaign pair has exactly one analyst; an analyst calibrates many sensors in many campaigns. What is the minimal relationship key?
  1. (sensor_id, campaign_id).
  2. (analyst_id, sensor_id, campaign_id).
  3. (analyst_id, campaign_id).
  4. (sensor_id) alone.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A club stores people who may be tutors, organizers, both, or neither. A table called Assignment must refer to any person through one ordinary foreign key. What mapping keeps common facts once and fits these requirements?
  1. Tutor and Organizer tables only, each copying the shared facts.
  2. Person plus Tutor and Organizer tables sharing Person’s key.
  3. One Person table with a type limited to TUTOR or ORGANIZER.
  4. Person plus two subclass tables with independent person identities.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A model links Site to Engineer and Engineer to Device. Devices may have no assigned engineer, but every device must still be locatable at a site. What missing relationship should be added?
  1. A second Site–Engineer assignment relationship.
  2. A recursive Device–Device support relationship.
  3. A direct Site–Device location relationship.
  4. A mandatory Engineer link for every device.
Show answerHide answer

Save this lesson to see this answer.

Set 3: Choose identifiers and test model changes10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A database contains the records “Atlas Team” and “Cedar Team,” each with a team code and contact name. What is the entity type shared by these records?
  1. Atlas Team.
  2. Team code.
  3. Contact name.
  4. Team.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A dataset contains these valid triples (carrier, item, destination): (C1, I1, D2), (C1, I2, D1), and (C2, I1, D1). If only the three pairwise projections are kept, what false triple could reappear when they are joined?
  1. (C1, I2, D2).
  2. (C1, I1, D1).
  3. (C2, I2, D1).
  4. (C2, I1, D2).
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

An editor can review the same manuscript in several rounds. Each round’s date and decision must be kept. Why is a Review entity identified only by (editor_id, manuscript_id) insufficient?
  1. The pair cannot link a review to its editor.
  2. The manuscript must become a multivalued attribute.
  3. The pair cannot distinguish repeated review rounds.
  4. A review decision cannot belong to an event.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A Chen model has a ternary Allocation relationship linking Team, Room, and Session, with seats_reserved on the relationship. How should a logical crow’s foot model represent it?
  1. An Allocation box with the attribute and links to all three types.
  2. Three pairwise lines with seats_reserved attached only to Team.
  3. A Session attribute listing every Team–Room combination as text.
  4. Two unrelated Room–Session and Team–Session allocation lines.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

An invoice requires a customer, but invoice_no is unique across all customers. Is Invoice weak because it must reference Customer?
  1. Yes; any mandatory customer link makes a type weak.
  2. Yes; customer_id must be added to its primary key.
  3. No; invoice_no identifies an invoice independently.
  4. No; invoices are events and events cannot be weak.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Car and Truck both store vehicle_id, make, and model year. Car adds seat count; Truck adds load capacity. What generalization keeps the shared conceptual facts in one place?
  1. Vehicle with Car and Truck subclasses.
  2. Vehicle one-to-one with independent types.
  3. Vehicle with attributes copied to subtypes.
  4. Entity types per make and model year.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

An address is modeled as street, postal code, and city, and each part must be queried separately. What columns does its direct table mapping contribute?
  1. address1, address2, and address3.
  2. One formatted address column.
  3. One address column plus each part.
  4. street, postal_code, and city.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

Course prerequisites are directed. The rules permit C1 to require C2 and C1 to require C3, but forbid a course requiring itself. Which mapping both preserves those links and rejects self-prerequisites?
  1. A junction with role-named course FKs and only course_code as PK, plus the same inequality check.
  2. A junction with role-named course FKs, a pair PK, and CHECK (course_code <> prerequisite_code).
  3. A junction with role-named course FKs and a pair PK, with no restriction on equal role values.
  4. One prerequisite_code FK on Course, with an inequality check against that row’s course_code.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

An application stores an up-to-date count of registrations for speed. What must happen when a registration is canceled?
  1. The stored count must stay fixed as a historical snapshot.
  2. The registration must remain so the count need not change.
  3. The count becomes a candidate key for the remaining rows.
  4. The stored count must be kept consistent with the registrations.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A lending schema has Item PK (catalog_id, copy_no), Member PK member_id, and Loan PK loan_id. It must keep repeat loans and reject nonexistent item combinations. What belongs in Loan?
  1. member_id FK plus one composite FK (catalog_id, copy_no) to Item.
  2. member_id FK plus separate references to catalog_id and copy_no.
  3. member_id as the only PK plus copy_no as the only item reference.
  4. One unique (member_id, catalog_id, copy_no) key with no loan_id.
Show answerHide answer

Save this lesson to see this answer.

Set 4: Diagnose constraints and information loss10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A project brief uses “client” and “customer” for the same organizations. Each organization has one registration number and one contact list. What should happen before drawing both as entity types?
  1. Merge the synonyms into one consistently named type.
  2. Keep two types because the brief uses two nouns.
  3. Use client for some organizations and customer for the others.
  4. Keep both types and copy each organization into both.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

Each sensor has a permanent, globally unique serial number. Sensors may share an optional label. Installations must keep referring to a sensor after its label changes. What is the smallest natural candidate key?
  1. (serial_number, label).
  2. label alone.
  3. serial_number alone.
  4. (label, installation_date).
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A Staff–Workshop M:N relationship records registration_date. The same staff member can register for different workshops on different dates. Why can registration_date not be one ordinary Staff attribute?
  1. Every date must belong to a separate Date entity type.
  2. Its value depends on the particular workshop registration.
  3. A staff member cannot have a single-valued date attribute.
  4. The date must be the primary key of Workshop.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

Each project must have at least two reviewers and may have more. What is the project’s participation pair for the review assignment?
  1. (0, 2).
  2. (1, 2).
  3. (2, 2).
  4. (2, N).
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A Chen diagram uses ratio labels: ORGANIZATION —1— EMPLOYS —N— WORKER. Worker has total participation; Organization has partial participation. What pair-style labels preserve the same rules?
  1. Worker (1, N); Organization (0, 1).
  2. Worker (0, N); Organization (1, 1).
  3. Worker (1, 1); Organization (0, N).
  4. Worker (0, 1); Organization (1, N).
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Account 27 is Checking only and Account 28 is Savings only in a disjoint, total hierarchy. Both accounts must keep their identities while exchanging subclasses. What final membership state preserves all these requirements?
  1. 27 in Checking and Savings; 28 in Checking only; both Account rows retained.
  2. 27 in Savings only; 28 in Checking only; both Account rows retained.
  3. 27 in Savings only; 28 in no subclass; both Account rows retained.
  4. Replace 27 and 28 with new Account IDs, then assign their new subclasses.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A disjoint, total Asset hierarchy has Vehicle and Building subclasses. Queries almost always read one subclass at a time, and no table needs a foreign key to all Assets. Which mapping stores only subclass tables?
  1. Vehicle and Building, each including inherited Asset columns.
  2. Asset plus Vehicle and Building with shared keys.
  3. One Asset table with a type column and all fields.
  4. One Asset table with a Boolean flag per subclass.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

Team requires one existing manager, and no Staff member may manage two teams. Every Staff row requires a Team, and both tables are empty. What design handles the first inserts while preserving the final rules, in a system supporting deferrable foreign keys?
  1. Required FKs both ways; UNIQUE manager_id; check each reference immediately after its row insert.
  2. Nullable manager_id FK; UNIQUE manager_id; no further check requires a manager after insertion.
  3. Required FKs both ways; no manager uniqueness; defer reference checks until transaction end.
  4. Required FKs both ways; UNIQUE manager_id; defer the reference checks until transaction end.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A booking table has booking_id as PK and stores required attendee_id, event_id, and session_no. One attendee can book a session only once but may book other sessions of the same event. What extra uniqueness constraint fits?
  1. UNIQUE (attendee_id, event_id).
  2. UNIQUE (event_id, session_no).
  3. UNIQUE (attendee_id, event_id, session_no).
  4. UNIQUE (booking_id, attendee_id, event_id, session_no).
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

Region has 1:N links to both Depot and Driver. The database must say which depot each driver works at. Why can joining Driver to Depot through Region give wrong assignments?
  1. It drops every driver whose region has several depots.
  2. It pairs drivers with depots that merely share their region.
  3. It collapses distinct drivers into one record per region.
  4. It restricts each depot to having exactly one driver.
Show answerHide answer

Save this lesson to see this answer.

Set 5: Transfer the design rules to new cases10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A model gives each Researcher exactly one Lab and each Lab exactly one Institute. Some labs have no researchers. It also stores a Researcher–Institute link that must always agree with the lab’s institute. What change removes duplication while preserving institute information for empty labs?
  1. Keep Researcher–Lab and Researcher–Institute; remove the Lab–Institute link.
  2. Keep all three links and allow the two researcher-to-institute routes to disagree.
  3. Keep Researcher–Lab and Lab–Institute; remove the direct Researcher–Institute link.
  4. Keep only Researcher–Institute and derive every lab’s institute from its researchers.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A crow’s foot relationship must express: each Certificate is issued to exactly one Learner, and a Learner can have zero or many Certificates. What marks belong beside Learner and Certificate, respectively?
  1. Zero or one; one or many.
  2. Zero or many; exactly one.
  3. One or many; zero or one.
  4. Exactly one; zero or many.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

Venue owns weak Hall with partial key hall_no, and Hall owns weak Locker with partial key locker_no. Hall and locker numbers repeat under different owners. Inspection has its own ID and must name exactly one locker. What reference preserves the full target identity and required participation?
  1. One NOT NULL composite FK (hall_no, locker_no) referencing Locker’s local numbers.
  2. One NOT NULL composite FK (venue_id, hall_no, locker_no) referencing Locker.
  3. One NOT NULL venue FK and one NOT NULL locker_no column, with no hall reference.
  4. One nullable composite FK (venue_id, hall_no, locker_no) referencing Locker.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A shared subclass inherits from both Researcher and Employee. What name describes a hierarchy that allows this multiple-superclass structure?
  1. A lattice.
  2. A ternary association.
  3. A weak ownership chain.
  4. A disjoint partition.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A Person hierarchy permits both Artist and Technician membership and also permits neither. In extended Chen notation, what circle letter and superclass line express those constraints?
  1. d with a single line.
  2. o with a double line.
  3. d with a double line.
  4. o with a single line.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A 1:1 optional pairing uses match_record(left_id, right_id). Both columns are NOT NULL foreign keys, and the only key is PRIMARY KEY (left_id, right_id). Rows (L1, R1) and (L1, R2) are both accepted. What constraint change enforces the maximum on both sides?
  1. Make only right_id individually UNIQUE.
  2. Add another composite UNIQUE (left_id, right_id).
  3. Make left_id and right_id individually UNIQUE.
  4. Allow NULL in left_id while keeping the same key.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A weak Bin has PK (aisle_id, bin_no). Dispatch stores the same two columns, both NOT NULL, but no combined reference. Bins (A, 4) and (B, 9) exist. What constraint rejects a dispatch to nonexistent bin (A, 9)?
  1. FOREIGN KEY (aisle_id, bin_no) REFERENCES bin (aisle_id, bin_no).
  2. FOREIGN KEY (aisle_id) REFERENCES aisle (aisle_id).
  3. UNIQUE (aisle_id, bin_no) on Dispatch alone.
  4. CHECK (aisle_id IS NOT NULL AND bin_no IS NOT NULL).
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A Person table has NOT NULL flags is_coach and is_judge. Membership may overlap but must be total. A team_id FK is optional for coaches and forbidden for people who are not coaches. Which CHECK expression implements those two rules?
  1. CHECK ((is_coach <> is_judge) AND (is_coach OR team_id IS NULL))
  2. CHECK ((is_coach OR is_judge) AND (is_coach OR team_id IS NULL))
  3. CHECK ((is_coach OR is_judge) AND (NOT is_coach OR team_id IS NOT NULL))
  4. CHECK ((is_coach AND is_judge) AND (is_coach OR team_id IS NULL))
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

Tools are numbered within a model, and the same member may borrow the same tool repeatedly. At most one checkout per tool can be open. What design preserves history, validates the physical tool, and enforces its availability rule?
  1. Checkout PK checkout_id; composite Tool FK (model_id, unit_no); at-most-one-open rule per tool.
  2. Checkout PK (member_id, model_id, unit_no); composite Tool FK; at-most-one-open rule per tool.
  3. Checkout PK checkout_id; Tool reference using unit_no alone; at-most-one-open rule per tool.
  4. Checkout PK checkout_id; composite Tool FK; no separate restriction on open checkout rows.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A model stores Warehouse–Robot for location and Warehouse–Operator–Robot for optional supervision. Why can the direct location link be useful even though it forms a cycle?
  1. The two routes necessarily record the same fact, so either can replace the other.
  2. Sharing a warehouse determines which operator supervises each robot.
  3. The direct link makes a caretaker mandatory for every robot.
  4. A robot’s location remains known when no operator supervises it.
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

83 Key Terms, each with its definition

A

Alternate candidate key
An alternate candidate key is a candidate key not chosen as primary; its presence and uniqueness still need to be enforced.
A trainer’s required distinct work email remains a non-null unique value when trainer ID is chosen as primary.
Arrow constraint
An arrow constraint in an ER notation variant points to an entity type that each opposite participant can be linked to at most once.
An arrow from Employs toward Department limits each employee to one department without setting the minimum.
Associative entity
An associative entity represents a relationship as an entity type, with participant links and any facts or further links of its own.
Enrollment has its own box holding score and connects each enrollment to one participant and one course.
Attribute
An attribute is a property recorded for instances of an entity type or relationship type, such as a course title or enrollment score.
The title describes a course; the score describes a particular participant’s enrollment in that course.
Attribute-defined specialization
An attribute-defined specialization determines subclass membership from the value of a defining attribute on the superclass.
An Account with account_type equal to SAVINGS belongs to the Savings subclass because of that stored value.

B

Binary relationship
A binary relationship associates instances of two entity types, with constraints describing the allowed partners on each side.
Trainer teaches Course is binary, even though one trainer may teach several courses during a term.
Book edition
A book edition is the cataloged bibliographic entity identified by ISBN in the library model, distinct from its physical owned copies.
One Book row can describe several copies of the same edition kept at different library branches.
Business rule
A business rule states a domain restriction or requirement that the design must preserve, even when diagram symbols cannot express it.
When a library limits each member to 10 open loans, that rule must be recorded and enforced beyond basic reference checks.

C

Candidate key
A candidate key is a minimal set of attributes that uniquely identifies an instance; no component can be removed without losing uniqueness.
Student number is a candidate key when the rules guarantee a different present number for every student.
Cardinality ratio
A cardinality ratio states the maximum partners allowed in both directions of a binary relationship, expressed as 1:1, 1:N, or M:N.
Department–Employee is 1:N when each employee belongs to at most one department and departments may have many employees.
Chasm trap
A chasm trap breaks a needed relationship path for valid instances because an optional intermediate association may be absent.
A car with no caretaker loses its route to Branch through Employee unless its location is stored directly.
CHECK constraint
A CHECK constraint rejects a row when its declared value condition is false, supporting rules that compare values within that row.
A return-date ordering check rejects a return before the loan date while allowing an open loan’s null return date.
Chen notation
Chen notation represents entity types with rectangles, relationships with diamonds, and attributes with ovals connected to their owners.
Score is an oval attached to ENROLLS, showing that it describes the enrollment link between participants.
Completeness constraint
A completeness constraint states whether the subclasses must cover every superclass instance or may leave some in no subclass.
The constraint decides whether the Person table may include Lena, who is neither a student nor an employee.
Composite attribute
A composite attribute contains meaningful component attributes that the database needs to represent or use separately.
An address is composite when the application must search by city without parsing a complete address string.
Composite foreign key
A composite foreign key validates a combination of columns against one referenced key, ensuring that the particular combination exists.
A loan’s ISBN and copy number must match the same Copy row, not values found in unrelated copy records.
Composite key
A composite key identifies instances using several attributes together, when the combination is needed to distinguish them.
Flight number and date together distinguish a scheduled flight whose number is reused on different days.
Conceptual design
Conceptual design organizes required data as entity types, attributes, and relationships without choosing storage structures.
The designer asks whether a department needs its own identity before choosing columns or SQL data types.
Copy
A copy is one physical instance of a cataloged book, identified in the library model by the book’s ISBN together with its copy number.
Copies 1 and 2 of the same book can be at one library branch while copy 3 is held at another.
Crow’s foot end marks
Crow’s foot end marks combine a minimum symbol farther from the box with a maximum symbol nearer the box to state partner counts.
Starting at Department, a circle and crow’s foot beside Employee allow that department to have no employees or many.
Crow’s foot notation
Crow’s foot notation puts attributes in entity boxes and uses paired marks on relationship lines to show minimum and maximum partners.
Two bars beside Department tell an employee that its department link reaches exactly one department.

D

Deferrable foreign key
A deferrable foreign key can, in a supporting system, be checked later in the transaction so mutually dependent rows can be created.
A required department and its required manager can be inserted before the deferred reference checks run.
Derived attribute
A derived attribute is a value calculated from other stored facts, sometimes together with a changing input such as today’s date.
A member’s current age is calculated from date of birth, so it need not be updated as a stored age each year.
Disjoint specialization
A disjoint specialization permits a superclass instance to belong to at most one of the subclasses in that specialization.
A vehicle cannot be both Car and Truck when the Vehicle hierarchy declares those subclasses disjoint.
Domain
A domain is the set of values an attribute is allowed to take, including any limits on its kind, size, or permitted range.
The credits attribute can be restricted to whole numbers from 1 to 30 instead of allowing arbitrary text.

E

Entity instance
An entity instance is one particular member of an entity type, with its own identity and values for the type’s attributes.
Amira Haddad, identified by student number 20417, is one instance of the entity type Student.
Entity type
An entity type is a category of distinguishable things about which the database keeps facts, such as people, objects, or events.
Course is an entity type even when a training center currently offers only one course in its catalog.
Entity-relationship model
An entity-relationship model describes the things a domain needs to record, their properties, and the associations between them.
A training center’s entity-relationship model links participants to courses before the designer chooses relational tables.

F

Fan trap
A fan trap leaves a required association missing between the many sides of two relationships that branch from the same entity type.
Sharing a faculty does not establish which department an instructor belongs to when that link is absent.
Foreign key
A foreign key is a column or group of columns whose non-null reference values must match an allowed key in a referenced table.
Employee’s department ID refers to a Department row, while a non-null rule determines whether it is required.

G

Generalization
Generalization finds a shared superclass for similar entity types and moves their common identity and facts to that shared level.
Car and Truck can be generalized as Vehicle, which holds registration number, make, and model year.

H

Historical snapshot
A historical snapshot preserves a value at the time of an event, keeping that recorded fact even when its current source later changes.
The value recorded for an order stays fixed when the corresponding product’s current value is revised.

I

Identifying relationship
An identifying relationship supplies an owner’s key as part of the child’s identity; many logical diagram tools show it as a solid line.
Building identifies Room together with room number, so Room’s primary key includes the building key.
Inheritance
Inheritance gives a subclass its superclass’s attributes and relationships, so shared facts apply to the same underlying instance.
Teaching Assistant inherits Person’s shared facts through its Student and Employee superclass paths.

J

Junction table
A junction table stores relationship instances as rows containing participant foreign keys and any attributes belonging to the links.
An enrollment row records one participant taking one course and keeps the score for that specific link.

L

Lattice
A lattice is a hierarchy structure allowing a subclass to have multiple superclasses and inherit the facts and relationships of each.
Teaching Assistant can be a subclass of both Student and Employee without describing two unrelated people.
Loan
A loan is one borrowing occurrence with its own identity, member, copy, and dates, allowing the same participants to recur over time.
A second borrowing of the same copy by the same member gets another loan ID and keeps the first event intact.
Logical design
Logical design translates a conceptual model into a relational schema of tables, keys, references, and other constraints.
A participant–course enrollment relationship becomes a table storing both references together with each enrollment’s score.

M

Membership-flag mapping
A membership-flag mapping stores a hierarchy in one table with a Boolean flag per subclass, allowing several memberships to be true.
A person who is both student and employee has both flags true, and one who is neither has both false, when Person permits overlap and partial membership.
Minimum–maximum pair
A minimum–maximum pair gives both bounds on an instance’s participation, such as exactly one link or zero to many links.
The Employee pair (1, 1) requires a department, while the Department pair (0, N) permits an empty department.
Multivalued attribute
A multivalued attribute can have several values for one entity instance, with each value describing that same instance.
A member can register a work phone and a mobile phone without the model imposing a fixed number of slots.

N

N-ary relationship mapping
An n-ary relationship mapping creates a table referencing every participant, with the relationship rules determining its identifying key.
Supply keeps supplier, part, and project together; a unique part–project rule can make that pair the primary key.
Natural key
A natural key uses an identifier that comes from the domain being modeled and has meaning beyond the database’s internal row labels.
ISBN can identify a book edition without the library generating a separate identifier for that purpose.
Non-identifying relationship
A non-identifying relationship links a child to a parent without making that parent key part of the child’s primary identifier.
An Order with its own order ID can require a Customer without including customer ID in its primary key.
NOT NULL constraint
A NOT NULL constraint requires a value in a column, preventing a row from representing that attribute or reference as missing.
A loan’s member reference is required so that every saved loan belongs to a particular existing member.
NULL
NULL represents a missing or inapplicable value in a database column; its meaning depends on the attribute and the model’s rules.
A loan’s return date remains null while the copy is still borrowed and becomes a date when it is returned.

O

ON DELETE CASCADE
ON DELETE CASCADE removes referencing rows when their referenced owner is deleted, implementing the chosen dependent-row lifecycle.
Deleting an order removes its order lines when their owner reference uses the cascading delete action.
Overlapping specialization
An overlapping specialization allows a superclass instance to belong to more than one of the subclasses at the same time.
A Person who studies and works can have both Student and Employee membership without duplicating identity.
Owner
An owner is the entity whose key contributes to the complete identifier of a weak entity through an identifying relationship.
Building A is the owner needed to identify room 101 when that room number also occurs in other buildings.

P

Partial key
A partial key distinguishes weak instances within one owner, while its values can repeat for instances under other owners.
Line number 1 distinguishes a line within an order, but order ID is also needed to identify it globally.
Partial participation
Partial participation allows an instance of an entity type to take part in no instances of the specified relationship.
A member who has never borrowed a copy has no loans, which the library’s member participation rule permits.
Partial specialization
A partial specialization permits superclass instances without any subclass membership, independently of whether overlap is allowed.
A Person instance can remain outside both Student and Employee when the Person hierarchy’s coverage is partial.
Participation constraint
A participation constraint states how many relationship instances an entity must take part in, including whether zero is allowed.
A newly created department may have no employees even when every employee must belong to a department.
Participation line
A participation line links an entity type to a Chen relationship; a double line requires participation and a single line permits none.
In a training center’s Chen diagram, a double line from Course to Teaches requires every course to have a trainer.
Physical design
Physical design chooses how a database stores and accesses data, including storage structures and indexes for its workload.
After the schema is settled, a database team can choose an index to support frequent course searches.
Primary key
A primary key is the candidate key chosen as a table’s main row identifier, with a unique, non-null value for every row.
Member ID stays the primary key when a member changes their name or shares an email with another member.

R

Ratio label
A ratio label marks a maximum in a Chen-style relationship and is read across the relationship to count possible partners.
N beside Employee says that a department may have many employees, not that an employee has many departments.
Recursive relationship
A recursive relationship associates instances of the same entity type in different roles, such as an employee and their supervisor.
A Course can require another Course, with role names identifying the course and its prerequisite.
Redundant relationship
A redundant relationship repeats a fact that can already be derived unambiguously from other relationships under the model’s rules.
A direct Course–Faculty link repeats the Course–Department–Faculty path when the two faculty assignments must always agree.
Relational schema
A relational schema specifies tables, their columns, their identifying keys, and the constraints connecting or restricting their rows.
A library schema adds a member_phone table to store each of a member’s registered numbers as a separate row.
Relationship attribute
A relationship attribute describes a particular association between participants, so its value belongs to the link’s full context.
Enrollment score can differ for the same participant across courses and for different participants in one course.
Relationship degree
The degree of a relationship describes its participating structure, such as binary, ternary, or recursive within one entity type.
A supply fact about one supplier, one part, and one project is ternary because it needs all three together.
Relationship instance
A relationship instance is one particular association between entities playing the roles specified by a relationship type.
A student’s enrollment in a Databases course is one relationship instance carrying the score for that enrollment.
Relationship type
A relationship type describes a kind of association that the database records between participating entity instances.
Participant enrolls in Course records which courses each participant takes, not merely that both types exist.
Repeated event
A repeated event is another occurrence involving the same participants, requiring an identifier that distinguishes the occurrences.
A member borrowing the same copy next month needs a new Loan record so the earlier loan dates remain available.
Requirements
Requirements state the data an organization needs, the rules it must follow, and the questions the database must answer.
A lending service needs to keep past borrowings as well as identify which tools are currently available.
Role
A role names the position an entity instance takes in a relationship, clarifying how the participating instances are connected.
Supervisor and supervisee distinguish the two Employee positions on the same recursive relationship.

S

Self-referencing foreign key
A self-referencing foreign key points to a key in the same table, using role-named columns to represent a recursive relationship.
Employee’s supervisor ID names another Employee row and can remain null for the top manager.
Simple attribute
A simple attribute is treated as one indivisible value for the purposes of the model, with no separately represented component parts.
Credits is a simple attribute, while an address may need separate street, postal code, and city parts.
Specialization
Specialization starts from a general entity type and defines subclasses whose instances need different attributes or relationships.
Employee is specialized into Instructor and Administrator when academic rank and office are needed separately.
Stored current result
A stored current result is a calculated value kept for repeated access that must remain consistent with changes to its underlying data.
A cached enrollment count must decrease when a participant cancels an enrollment included in that count.
Strong entity type
A strong entity type has a key that identifies its instances independently, even when its relationships require other entities to exist.
A purchase with a globally unique purchase number remains strong despite requiring a customer link.
Subclass
A subclass is a specialized group whose instances are also instances of a superclass and inherit its facts while adding their own.
Student adds enrollment year while retaining the same Person identity and inherited date of birth.
Subclass-only mapping
A subclass-only mapping stores inherited facts in each subclass table and requires total coverage because no superclass table remains.
A person in neither subclass cannot be stored when Student and Employee are the only destination tables.
Superclass
A superclass is an entity type that holds the shared identity, attributes, and relationships inherited by its specialized subclasses.
Person defines name and date of birth once for people who may also be students or employees.
Superclass-plus-subclass mapping
A superclass-plus-subclass mapping stores shared facts in one table and uses its key as both primary and foreign key in each subclass.
Mei has one Person row and matching Student and Employee rows when she belongs to both subclasses.
Surrogate key
A surrogate key is an identifier generated solely to distinguish records, with no separate meaning in the organization’s domain.
A generated member ID gives a stable reference while name, address, and email remain editable facts.

T

Ternary relationship
A ternary relationship records one joint association among three participants whose complete combination gives the fact its meaning.
A delivery quantity belongs to the supplier–part–project triple, not to any one participant alone.
Total participation
Total participation requires every instance of an entity type to take part in at least one instance of the specified relationship.
Every Loan must identify a Member, so Loan participates totally in its relationship with Member.
Total specialization
A total specialization requires every superclass instance to have at least one subclass membership, whether memberships overlap or not.
A new university member must be classified as a student, an employee, or both under total overlapping coverage.
Type-column mapping
A type-column mapping stores a disjoint hierarchy in one table, with one value selecting membership and checks governing subclass fields.
A single Person type value cannot represent Mei as both Student and Employee in an overlapping hierarchy.

U

UNIQUE constraint
A UNIQUE constraint prevents duplicate non-null key values in its declared column combination and does not itself require presence.
Making a department’s manager reference unique stops two departments from choosing the same employee.

W

Weak entity type
A weak entity type lacks an independent key and identifies its instances through an owner’s key combined with its own partial key.
Copy number 2 is distinguished from another book’s copy 2 by including the owning book’s ISBN.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started