Course registration ERD
Student, course, enrolment and professor. Enrolment resolves student-course many-to-many and is where the grade belongs.
The diagram
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
| Shape | Symbol | Connections |
|---|---|---|
| Student | Entity | holds student_no, name, major · → Enrollment(registers) |
| Course | Entity | holds course_code, course_name, professor_id, credits · → Enrollment(offered_in) · ← Professor |
| Enrollment | Entity | holds enrollment_id, student_no, course_code, grade · ← Student, Course |
| Professor | Entity | holds professor_id, professor_name · → Course(teaches) |
Symbols used here
| Symbol | Meaning |
|---|---|
| Entity | A 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 one | Two short bars at the line end. |
| Zero or many | A crow's foot and a circle. |
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