UNIHIVE

Study Hub UNIPORT CSC 480

CSC 480 · Database Management

Entity-relationship modelling

Entities, attributes and their types, relationships, degree, cardinality and participation, weak entities, enhanced E-R (specialisation and generalisation), and mapping an E-R diagram to tables.

Our notes

2 min read

Building blocks

  • Entity: a thing of interest with independent existence (Student, Course, Department). An entity type is the set; an entity is one member.
  • Attribute: a property (MatNo, Name, Level).

  Kinds: simple vs composite (Name = first + surname); single-valued vs multi-valued (phone numbers); stored vs derived (Age from DateOfBirth, CGPA from results).

  • Key attribute: uniquely identifies an entity (MatNo).
  • Relationship: an association among entities (Student REGISTERS Course).

Chen notation

Rectangles = entity types; ellipses = attributes (key underlined; double ellipse = multi-valued; dashed = derived); diamonds = relationships; double rectangle = weak entity.
Crow's foot notation (used in most tools) shows cardinality with line ends.

Constraints on relationships

  • Degree: unary (recursive: Student MENTORS Student), binary (most common), ternary (Lecturer TEACHES Course IN Semester).
  • Cardinality ratio: 1:1 (Department HEADED BY Lecturer), 1:N (Department OFFERS Course), M:N (Student REGISTERS Course).
  • Participation: total (every course must belong to a department: double line) or partial (not every lecturer heads a department).
  • Relationships can have attributes: REGISTERS has Score and Session.

Weak entities

Cannot be identified by their own attributes alone; depend on an owner entity. Example: Dependant of an Employee (identified by EmployeeNo + DependantName); a Hostel Room identified by Hall + RoomNo.

Enhanced E-R (EER)

  • Specialisation: a superclass divided into subclasses (Person → Student, Staff). Generalisation is the reverse (combine Lecturer and Technician into Staff).
  • Constraints: disjoint vs overlapping (can a person be both student and staff? yes: postgraduate assistants, so overlapping), total vs partial.
  • Subclasses inherit the superclass's attributes and relationships.

Mapping E-R to tables

  1. Each strong entity → a table; key → primary key; composite attributes → their simple parts.
  2. Weak entity → table with the owner's key plus its partial key as the primary key.
  3. 1:N relationship → put the "one" side's key as a foreign key in the "many" side's table (Course gets DeptCode).
  4. 1:1 → foreign key on the side with total participation.
  5. M:N → a new junction table with both keys (Registration(MatNo, CourseCode, Session, Score)).
  6. Multi-valued attribute → a separate table (StudentPhone(MatNo, Phone)).
  7. Specialisation → one table per class sharing the key, or one table with a type column.

Worked example (running database).
Department(DeptCode, DeptName, Faculty)
Student(MatNo, FirstName, Surname, Level, DeptCode → Department)
Course(CourseCode, Title, Units, DeptCode → Department)
Registration(MatNo → Student, CourseCode → Course, Session, Score)

Exams usually ask: draw an E-R diagram for a described scenario (library, hospital, hostel allocation, course registration); identify attribute types; cardinality and participation; weak entities; map an E-R diagram to relations.

Common mistake: putting a multi-valued or M:N fact into a single column (a "Courses" column holding a list). M:N relationships always become a separate table.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All CSC 480 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.