Diagram Desk

Course registration ERD

Student, course, enrolment and professor. Enrolment resolves student-course many-to-many and is where the grade belongs.

The diagram

StudentPK student_no intname varcharmajor varcharCoursePK course_code varcharcourse_name varcharFK professor_id intcredits intEnrollmentPK enrollment_id intFK student_no intFK course_code varchargrade varcharProfessorPK professor_id intprofessor_name varcharregistersoffered_inteaches
ER diagram · 17 shapes

Reading it step by step

  • 'Student' has 3 attributes, primary key student_no.
  • 'Course' has 4 attributes, primary key course_code, foreign key professor_id.
  • 'Enrollment' has 4 attributes, primary key enrollment_id, foreign key student_no, course_code.
  • 'Professor' has 2 attributes, primary key professor_id.
  • Each 'Student' relates to zero or more 'Enrollment'; each 'Enrollment' to exactly one 'Student' (registers).
  • Each 'Course' relates to zero or more 'Enrollment'; each 'Enrollment' to exactly one 'Course' (offered_in).
  • Each 'Professor' relates to zero or more 'Course'; each 'Course' to exactly one 'Professor' (teaches).

Shape by shape

ShapeSymbolConnections
StudentEntityholds student_no, name, major · → Enrollment(registers)
CourseEntityholds course_code, course_name, professor_id, credits · → Enrollment(offered_in) · ← Professor
EnrollmentEntityholds enrollment_id, student_no, course_code, grade · ← Student, Course
ProfessorEntityholds professor_id, professor_name · → Course(teaches)

Symbols used here

SymbolMeaning
EntityA thing to store: name on top, attributes below.
Primary key (PK)The attribute that identifies one row; underlined.
Foreign key (FK)An attribute pointing to another entity's key.
Exactly oneTwo short bars at the line end.
Zero or manyA crow's foot and a circle.

All er diagram symbols and how to draw

Diagram text

Paste this text into the editor to get the same picture, then change the names to fit your own work.

# Course registration ERD
erDiagram
  Student {
    int student_no PK
    varchar name
    varchar major
  }
  Course {
    varchar course_code PK
    varchar course_name
    int professor_id FK
    int credits
  }
  Enrollment {
    int enrollment_id PK
    int student_no FK
    varchar course_code FK
    varchar grade
  }
  Professor {
    int professor_id PK
    varchar professor_name
  }
  Student ||--o{ Enrollment : registers
  Course ||--o{ Enrollment : offered_in
  Professor ||--o{ Course : teaches

More er diagram examples

All SeewolLabs tools