Premium Chapter

ER model & relational algebra

Computer Science & Applications (Paper 2) (Code 87) · Unit 4 · ~16 min read · Original chapter

Free previewPremium full chapter

Free preview

Database design starts before any table exists, with the ER model: entities (things), attributes (properties) and relationships (connections). A weak entity cannot be identified by its own attributes alone — a bank account's transactions, for example, need the account number plus a transaction number to be unique. Worked example — ER to relations: Student(student_id, name) and Course(course_id, title) with a many-to-many Enrols relationship carrying a grade become three relations: Students(student_id, name), Courses(course_id, title) and Enrolments(student_id, course_id, grade), where the pair of foreign keys is the key of the new relation. The rule is mechanical: many-to-many always becomes its own relation, while one-to-many puts the foreign key on the many side.

Checking premium access…