What is E-R diagram?

A diagram depicting the things managed in a database (entities) and the relationships between them. Relationships have multiplicities such as one-to-one, one-to-many and many-to-many. A many-to-many relationship is implemented in tables by adding an associative entity that holds both primary keys as foreign keys, breaking it into two one-to-many relationships.

Japanese name: E-R図

E-R diagram appears in 1 practice question across 1 topic, including Database Basics.

Field: Database Basics

Try it: questions about E-R diagram

In an E-R diagram, there is a many-to-many relationship between students and courses: one student takes several courses, and one course is taken by several students. Which is an appropriate way to implement this relationship with relational database tables?

  1. ACreate a new enrollment table holding student_no and course_no as foreign keys
  2. BAdd one course_no column to the student table
  3. CAdd one student_no column to the course table
Show answer and explanation

Answer: A. Create a new enrollment table holding student_no and course_no as foreign keys

An E-R diagram depicts the things managed in a database (entities) and the relationships between them, and each relationship has a multiplicity (cardinality) such as one-to-one, one-to-many or many-to-many. A one-to-many relationship can be represented by giving the table on the many side the primary key of the one side as a foreign key (for example, giving the employee table a dept_code column). A many-to-many relationship, however, cannot be represented by adding one column to either table, because that records only one course per student (or one student per course). Instead, an enrollment table (an associative entity) holding student_no and course_no as foreign keys is placed between them, breaking the relationship into two one-to-many relationships: student to enrollment and course to enrollment. The primary key of the enrollment table is usually the combination of student_no and course_no.

E-R diagram in the explanations

Questions that mention E-R diagram (1)

  1. In an E-R diagram, there is a many-to-many relationship between students and courses: one student takes several courses, and one course is taken by several students. Which is an appropriate way to implement this relationship with relational database tables?

Books on Database Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

Relational database Primary key Foreign key ACID properties Database index Database view Isolation level Normalization NoSQL SQL

Back to the glossary