ER diagram symbols: Chen, crow's foot and IDEF1X

ER diagram symbols in Chen, crow's foot and IDEF1X side by side: what each box, oval, diamond and line end means, and the SQL Server table it becomes.

What do the symbols in an ER diagram mean?

An ER diagram shows three things: what you store (entities), the facts you keep about each (attributes), and how they connect (relationships). Every notation has a symbol for each, plus a way to say how many rows sit at each end of a relationship. The three you will meet most draw them very differently:

  • Chen: an entity is a rectangle , an attribute an oval on a stalk, a relationship a diamond between two rectangles, with 1, N or M written on its lines. It describes the world before there are tables.
  • Crow’s foot: an entity is a box listing its columns, a relationship is a line, and the marks at each end of the line say “one” , “many” and “or zero” .
  • IDEF1X: boxes and lines too, with a dot at the child end, a letter beside the dot for the count, square or rounded corners, and (FK) after each foreign key column. It was published as a US federal standard, FIPS 184, for relational designs.

The chart puts the three side by side, one row per kind of symbol:

Chart of ER diagram symbols in three columns, Chen, crow's foot and IDEF1X, with rows for entity, attribute or column, key, relationship and line ends. Chen: a rectangle and a double rectangle, a plain and a dashed oval, an underlined key oval, a diamond between two rectangles with 1 and N, single and double lines. Crow's foot: a table box with PK, FK and AK columns, solid and dashed lines, and the ends exactly one, zero or one, one or more and zero or more. IDEF1X: square and rounded boxes, (FK) and (AK1), solid and dashed lines, a dot, a dot with P, a dot with Z and a hollow diamond.
ER diagram symbols in Chen, crow's foot and IDEF1X. Drawn for this post, the crow's foot and IDEF1X marks at the sizes ERDsmith draws them.

The example is a university, smaller than the one in the university database template. Departments employ professors and offer courses, each course runs in numbered sections, and students enroll in sections. Each symbol below is followed to the table it becomes, and every script runs on SQL Server.

Chen notation: rectangles, ovals and diamonds

A Chen diagram of the university has rectangles for Department, Professor, Course, Section and Student, ovals around each, and diamonds between them:

Chen diagram of the university: rectangles Department, Professor, Course, Student and the double rectangle Section; diamonds employs, offers, teaches and enrolls, the double diamond has between Course and Section; 1, N and M on the lines; double lines from Professor to employs, Course to offers and Section to has; ovals for the attributes, the keys underlined, SectionNumber with a dashed underline, Phone a double oval, FullName a dashed oval, Name with FirstName and LastName, Grade on enrolls.
The university in Chen notation. Drawn for this post: ERDsmith draws tables, not Chen.

The symbols, and what each becomes once there are tables:

  • Rectangle : an entity, later a table. Department becomes dbo.Department.
  • Oval : an attribute, later a column. An underlined oval is the key attribute, later the primary key.
  • Oval with ovals of its own : a composite attribute. A professor’s name, split into first and last, becomes two columns.
  • Double oval : a multivalued attribute, such as a professor’s phone numbers. A column holds one value, so it becomes a table of its own, keyed by the professor and the number.
  • Dashed oval : a derived attribute, worked out from others. In SQL Server it can be a computed column.
  • Diamond : a relationship, with 1, N or M on its lines: Department 1, employs, N Professor.
  • Double line between an entity and a diamond: total participation, every professor works in some department. A single line is partial: a section may have no professor yet.
  • Double rectangle : a weak entity, one with no key of its own. “Section 2” means nothing until you say of which course. Its partial key, the section number, is underlined with a dashed line .
  • Double diamond : the identifying relationship that ties a weak entity to its owner.

Chen has no symbol for a foreign key, because there are no tables yet. A 1:N diamond doesn’t become a table; it becomes a column on the N side. Every other picture on this page shows tables, so it has no ovals and no diamonds: each oval becomes a row in a box, and each diamond a line or a table.

Crow’s foot symbols: Chen’s university as tables

The strong entities Department, Professor and Course, with their two 1:N diamonds, give three tables. Each diamond turns into a foreign key column on its N side:

CREATE TABLE dbo.Department (
    DepartmentId int NOT NULL
        CONSTRAINT PK_Department PRIMARY KEY,
    Name nvarchar(100) NOT NULL
        CONSTRAINT AK_Department_Name UNIQUE
);

CREATE TABLE dbo.Professor (
    ProfessorId int NOT NULL
        CONSTRAINT PK_Professor PRIMARY KEY,
    DepartmentId int NOT NULL
        CONSTRAINT FK_Professor_Department
        REFERENCES dbo.Department (DepartmentId),
    FirstName nvarchar(50) NOT NULL,
    LastName nvarchar(50) NOT NULL,
    FullName AS FirstName + N' ' + LastName
);

CREATE TABLE dbo.Course (
    CourseId int NOT NULL
        CONSTRAINT PK_Course PRIMARY KEY,
    DepartmentId int NOT NULL
        CONSTRAINT FK_Course_Department
        REFERENCES dbo.Department (DepartmentId),
    Code varchar(10) NOT NULL
        CONSTRAINT AK_Course_Code UNIQUE,
    Title nvarchar(100) NOT NULL
);
dbo.Department with primary key DepartmentId and alternate key Name; dbo.Course and dbo.Professor each with a foreign key DepartmentId; dashed lines from Department to Course and from Department to Professor.
The two 1:N diamonds are two dashed lines. The composite name is FirstName and LastName; the derived FullName is a computed column.

The weak entity and its double diamond give a table whose primary key holds its owner’s key. A one-to-one relationship, at most one syllabus per course, gives a table whose primary key is also its foreign key:

CREATE TABLE dbo.Section (
    CourseId int NOT NULL
        CONSTRAINT FK_Section_Course
        REFERENCES dbo.Course (CourseId),
    SectionNumber smallint NOT NULL,
    ProfessorId int NULL
        CONSTRAINT FK_Section_Professor
        REFERENCES dbo.Professor (ProfessorId),
    Room varchar(10) NULL,
    CONSTRAINT PK_Section
        PRIMARY KEY (CourseId, SectionNumber)
);

CREATE TABLE dbo.Syllabus (
    CourseId int NOT NULL
        CONSTRAINT PK_Syllabus PRIMARY KEY
        CONSTRAINT FK_Syllabus_Course
        REFERENCES dbo.Course (CourseId),
    Body nvarchar(max) NOT NULL
);
dbo.Section with primary key CourseId and SectionNumber, CourseId also a foreign key to dbo.Course; dbo.Syllabus whose primary key CourseId is a foreign key to dbo.Course; a dashed line from dbo.Professor to Section.ProfessorId.
Section and Syllabus hang from Course on solid lines and have rounded corners: their primary keys hold CourseId. The line from Professor has a bar and a ring at Professor, because ProfessorId allows NULL.

dbo.Section is the weak entity. Its key is the pair (CourseId, SectionNumber), a composite key whose first column is the foreign key to its owner. Chen’s dashed underline on the section number has become the second column of a primary key, and the double diamond has become the solid line .

Read a crow’s foot line from the parent end to the child end. The chart above has its ends, and the crow’s foot notation cheat sheet explains each one. The pictures above add three things:

  • One bar at the parent : exactly one. A parent’s end is never many, so the pictures draw one bar where the chart has two .
  • A ring and a bar at the child : zero or one. The foreign key column is also unique, here the whole primary key of dbo.Syllabus, so a course has at most one syllabus.
  • (FK), (AK) after a column: foreign key, alternate key (a unique constraint). The primary key sits above the line, where the chart writes PK.

What SQL Server does with each crow’s foot end

Each end you can declare is a constraint SQL Server checks. This script fills the tables with one row against each symbol:

INSERT dbo.Department (DepartmentId, Name)
VALUES (1, N'Mathematics');

INSERT dbo.Professor (ProfessorId, DepartmentId,
    FirstName, LastName)
VALUES (1, 1, N'Emmy', N'Noether');

INSERT dbo.Professor (ProfessorId, DepartmentId,
    FirstName, LastName)
VALUES (2, NULL, N'Alan', N'Turing');

INSERT dbo.Course (CourseId, DepartmentId, Code, Title)
VALUES (10, 1, 'MATH101', N'Calculus I'),
       (11, 1, 'MATH102', N'Calculus II');

INSERT dbo.Section (CourseId, SectionNumber, ProfessorId)
VALUES (10, 1, 1),
       (10, 2, NULL);

INSERT dbo.Section (CourseId, SectionNumber, ProfessorId)
VALUES (99, 1, 1);

INSERT dbo.Syllabus (CourseId, Body)
VALUES (10, N'Limits, derivatives, integrals.');

INSERT dbo.Syllabus (CourseId, Body)
VALUES (10, N'A second syllabus.');
Msg 515, Level 16, State 2, Line 8
Cannot insert the value NULL into column 'DepartmentId', table 'University.dbo.Professor'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Msg 547, Level 16, State 1, Line 20
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Section_Course". The conflict occurred in database "University", table "dbo.Course", column 'CourseId'.
The statement has been terminated.
Msg 2627, Level 14, State 1, Line 26
Violation of PRIMARY KEY constraint 'PK_Syllabus'. Cannot insert duplicate key in object 'dbo.Syllabus'. The duplicate key value is (10).
The statement has been terminated.

Msg 515 is the bar at Department: Professor.DepartmentId is NOT NULL, so a professor without a department can’t go in. Section 2 of course 10 went in with no professor, as the ring at Professor allows. Msg 547 is the line itself: there is no course 99 for the section to belong to. Msg 2627 is the bar at the syllabus end: the foreign key is the primary key, so a second syllabus for course 10 is a duplicate. Each failed insert ended only its own statement; the rows around it went in.

Course 11 went in with no sections, and nothing in the script could have stopped it. A foreign key checks each child row against its parent, never that a parent has children. So the bar with the foot , one or more, has no constraint behind it, and neither has a Chen double line from Course to the diamond that links it to its sections. The diagram can say every course runs at least one section; making it true is left to a trigger or the application.

IDEF1X symbols on the same tables

The many-to-many diamond is the last Chen symbol to place. A student enrolls in many sections, a section has many students, and the enrollment has an attribute of its own, the grade. Chen draws Grade as an oval on the diamond. A table can’t hang a column on a line, so the diamond becomes a table keyed by both sides:

CREATE TABLE dbo.Student (
    StudentId int NOT NULL
        CONSTRAINT PK_Student PRIMARY KEY,
    Name nvarchar(100) NOT NULL
);

CREATE TABLE dbo.Enrollment (
    StudentId int NOT NULL
        CONSTRAINT FK_Enrollment_Student
        REFERENCES dbo.Student (StudentId),
    CourseId int NOT NULL,
    SectionNumber smallint NOT NULL,
    Grade char(2) NULL,
    CONSTRAINT PK_Enrollment
        PRIMARY KEY (StudentId, CourseId, SectionNumber),
    CONSTRAINT FK_Enrollment_Section
        FOREIGN KEY (CourseId, SectionNumber)
        REFERENCES dbo.Section (CourseId, SectionNumber)
);
IDEF1X diagram of dbo.Department, dbo.Professor, dbo.Course, dbo.Syllabus, dbo.Section, dbo.Student and dbo.Enrollment; dbo.Enrollment's primary key holds foreign keys to dbo.Student and dbo.Section; a hollow diamond at dbo.Professor on the dashed line to dbo.Section.
All seven tables in IDEF1X: a dot at every child end, Z at the syllabus, a hollow diamond at Professor for the optional line, rounded corners where a key holds a parent's key.

IDEF1X says the same things as crow’s foot with fewer marks. The lines are solid and dashed as in crow’s foot; the rest differs:

  • Square and rounded corners : an independent entity, with a key of its own (Department, Professor, Course, Student), and a dependent one, whose key holds a parent’s key (Section, Syllabus, Enrollment).
  • A filled dot at the child end: zero, one or more. With Z beside it: zero or one, as at the syllabus.
  • A hollow diamond at the parent end: the relationship is optional, its foreign key allows NULL, as Section.ProfessorId does.
  • (FK) and (AK1) after a column: a foreign key, and a column of the first alternate key. The primary key sits above the line in the box.

IDEF1X notation reads every mark against the standard, the P and the numbers included. dbo.Enrollment is the M:N diamond as a table: two solid lines, one from each side, and a primary key made of both foreign keys. Grade, the diamond’s own attribute, is a plain column below the line.

How ERDsmith helps

The inserts into the university showed which symbols SQL Server stands behind: the bar at Department came back as Msg 515, the bar at the syllabus as Msg 2627, and the one-or-more end on Course’s sections as nothing at all. Drawn by hand, a symbol and its table can disagree: a ring on a NOT NULL column or a foot on a unique one, and you find out when a row is refused or let in.

ERDsmith is a tool for physical models. It draws the tables you will create, in crow’s foot or IDEF1X; it does not draw Chen’s ovals and diamonds. What it draws follows the columns, so a symbol can’t contradict its table:

  • A non-identifying relationship is optional, a ring in crow’s foot or a hollow diamond in IDEF1X, exactly when its columns allow NULL.
  • The count at the child end, one or more included, is a choice you set on the relationship and keep on the diagram, though no CREATE TABLE can say it.
  • The notation is a display setting of each diagram, with a legend for the one in use, so the same model reads either way.