| Lesson 3 | Types of Entity-Relationship Diagrams |
| Objective | Compare the three most common ER notations (Crow’s Foot, Chen, IDEF1X) and learn when to use each. |
ER diagrams come in multiple notations. The three you will see most often are:
Unifying business rule used below: “An OFFICE is assigned to employees.” Read bidirectionally: an office can have zero or many employees; each employee belongs to exactly one office.
O<) = optional, many. An office may have zero, one, or many employees.||) = mandatory, one. Every employee must belong to exactly one office.
OFFICE (1) to EMPLOYEE (N) via assign.
OFFICE; Child: EMPLOYEE.OFFICE_ID migrates into EMPLOYEE and commonly participates in the child’s primary key in an identifying relationship.Given the business rule above, a typical relational mapping is:
-- Entities
CREATE TABLE office (
office_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
office_code VARCHAR2(20) UNIQUE NOT NULL,
name VARCHAR2(100) NOT NULL
);
CREATE TABLE employee (
employee_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
office_id NUMBER NOT NULL,
last_name VARCHAR2(60) NOT NULL,
first_name VARCHAR2(60) NOT NULL,
CONSTRAINT fk_employee_office
FOREIGN KEY (office_id) REFERENCES office(office_id)
);
-- Business rule checks
-- 1) Each employee must belong to exactly one office → NOT NULL + FK on employee.office_id
-- 2) An office may have zero or many employees → no extra constraint on office
IDEF1X variant (identifying): If EMPLOYEE identity depends on OFFICE, you could model a composite key:
CREATE TABLE employee_identifying (
office_id NUMBER NOT NULL,
employee_no NUMBER NOT NULL,
last_name VARCHAR2(60) NOT NULL,
first_name VARCHAR2(60) NOT NULL,
CONSTRAINT pk_emp_ident PRIMARY KEY (office_id, employee_no),
CONSTRAINT fk_emp_ident_office
FOREIGN KEY (office_id) REFERENCES office(office_id)
);
OFFICE ||───O< EMPLOYEE → mandatory one on the EMPLOYEE→OFFICE side; optional many on the OFFICE→EMPLOYEE side.OFFICE - <assign> - EMPLOYEE with (1) and (N) markers and participation (total/partial) shown by line styles or adornments.In this module you will work primarily with the Crow’s Foot notation. Next, we’ll apply its conventions to diagram entities and attributes.
The following page goes into greater detail regarding these three types of models.
idef1x Crowsfoot | Chen-model