Black Friday race Join
General

Chen ER diagram template

Students, courses and instructors in Chen notation: rectangles for entities, ovals for attributes, diamonds for relationships. Replace them with the things in your own data.

The Chen ER diagram template

What is a Chen ER diagram?

An entity-relationship diagram describes the things a system keeps data about and how those things relate. Chen notation, named after Peter Chen, who introduced the ER model, is the original way to draw one. It gives every idea its own shape: a rectangle for an entity, an oval for an attribute and a diamond for a relationship.

The template models a school. Student, Course and Instructor are the entities. Enrolls connects students to courses, Teaches connects courses to instructors, and eleven ovals around them hold the attributes.

The Chen ER diagram template: rectangles Student, Course and Instructor in a row, diamonds Enrolls and Teaches between them, attribute ovals above and below.
Three entities, two relationships and the attributes that describe them.

Entities and their attributes

Take Student. The rectangle is the entity: a kind of thing with many instances, one per student. The three ovals joined to it are its attributes, the facts stored about each one: student_id, name and email.

One of them is underlined. An underlined attribute is the key: the value that tells one student from every other. Two students can share a name, but never a student_id. Course has course_id and Instructor has instructor_id for the same reason. Every entity needs a key, and finding it is the first real modeling decision you make.

The underlined oval is the key that identifies each student.

Relationships and cardinality

The diamond between Student and Course reads as a verb: a student Enrolls in a course. Chen notation writes relationships out like this, so the middle row of the board reads as a sentence.

The letters beside the lines give the cardinality: how many of one side can pair with the other. Enrolls has M on the student side and N on the course side. That is many-to-many: a student takes several courses and a course has several students.

Teaches is different. It has N beside Course and 1 beside Instructor, so an instructor can teach many courses but each course has a single instructor.

M on one side and N on the other: a many-to-many relationship.

Put each attribute where it belongs

Under the Enrolls diamond hangs an oval named grade. It is attached to the relationship, not to an entity, and that placement is correct. A grade does not describe a student alone or a course alone. It describes one student in one course.

The same test puts semester on Teaches: it says when this instructor taught this course. Before you add an oval, ask what the fact depends on. If it needs one entity to make sense, attach it there, as department is attached to Instructor. If it needs two, it belongs to the diamond between them.

semester belongs to Teaches; department belongs to Instructor.

How to use the Chen ER diagram template

  1. Open it as a new board. Use this template adds the school model to your workspace. It is a Pro template and needs the Pro or Team plan.
  2. Rename the rectangles to your nouns. Replace Student, Course and Instructor with the things your system stores, such as customer, order and product. Use singular names.
  3. Name each diamond with a verb. Read the row aloud. “Customer places order” works. If you cannot find a verb, the two entities may not be related directly.
  4. Set the 1, M and N marks. For each line, ask how many of the far side one instance can have. Change the letters beside Enrolls and Teaches to match your rules.
  5. Hang the ovals and underline one key per entity. Replace title and credits with your own fields, and move any fact that depends on two entities onto the diamond.
Course keeps the same pattern: one key and two descriptive attributes.

Chen notation or crow’s foot?

Chen notation is the clearest way to think about data. It keeps relationships visible as their own shapes and is the style many database courses teach first. Use it for early modeling, for teaching, and for talking a design through with people who do not read schemas.

It takes space, though. With twenty entities the ovals crowd the board. At that point move to the crow’s foot style of the ER diagram template, which lists attributes inside each box. When the model is settled and you need types and foreign keys, continue with the database schema. For objects with behavior rather than tables, a UML class diagram fits better. The guide how to draw an ER diagram for your database walks through the whole process.

Questions about the Chen ER diagram template

What do M, N and 1 mean on the lines?

They state how many instances can take part. 1 means at most one, while M and N both mean many. In the template, Enrolls is M to N, so students and courses pair freely, and Teaches is N to 1, so each course has one instructor who may teach several courses.

Why is one attribute underlined?

The underline marks the key attribute, the value that is unique for every instance of the entity. student_id, course_id and instructor_id are the keys in the template. When the model becomes a database, the key usually becomes the table’s primary key.

How does a many-to-many relationship become a table?

It becomes a table of its own. Enrolls would turn into an enrollment table holding a student_id, a course_id and the relationship’s own attribute, grade. This is one reason Chen notation draws the relationship as a shape: you can see the future table before you build it.

Can a relationship connect more than two entities?

Yes. A diamond can join three entities, which is called a ternary relationship, for example an instructor teaching a course in a room. Chen notation handles this naturally: add a third line to the diamond and a cardinality mark on each.