mapping a weak entity (Blog_Posting)
ER-to-Relational Mapping and DDL
The 7-step ER-to-relational mapping algorithm (strong and weak entities, 1:1, 1:N and M:N relationships, multivalued attributes, n-ary relationships), basic DDL (CREATE TABLE, keys, foreign keys, data types, constraints), and step 8 options for mapping specialization.
How to read this page
Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.
All 76 slides
- 1 ER-to-Relational Mapping and DDL
- 2 LEARNING GOALS
- 3 GOALS DURING MAPPING
- 4 Slide 4
- 5 Slide 5
- 6 ER-TO-RELATIONAL MAPPING ALGORITHM
- 7 ER-TO-RELATIONAL MAPPING ALGORITHM
- 8 strong
- 9 REGULAR ENTITY TYPES WITH COMPOSITE ATTRIBUTES
- 10 REGULAR ENTITY TYPES (EMPLOYEE)
- 11 REGULAR ENTITY TYPES (DEPARTMENT)
- 12 REGULAR ENTITY TYPES (PROJECT)
- 13 ER-TO-RELATIONAL MAPPING ALGORITHM 595
- 14 ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
- 15 WEAK ENTITY TYPES
- 16 DDL BASICS
- 17 DDL BASICS (PRIMARY KEY)
- 18 DDL BASICS (COMPOSITE KEYS AND NAMING CONSTRAINTS)
- 19 DDL BASICS (FOREIGN KEYS)
- 20 ACTIVITY
- 21 ACTIVITY (SOLUTION)
- 22 A BIT MORE DDL
- 23 SOME SQL DATA TYPES (MYSQL)
- 24 DDL CONSTRAINTS
- 25 ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
- 26 MAPPING OF BINARY 1:1 RELATIONSHIP TYPES
- 27 1:1 FOREIGN KEY APPROACH
- 28 1:1 FOREIGN KEY APPROACH
- 29 1:1 FOREIGN KEY APPROACH
- 30 MAPPING OF BINARY 1:1 RELATIONSHIP TYPES
- 31 1:1 MERGED RELATION APPROACH
- 32 MAPPING OF BINARY 1:1 RELATIONSHIP TYPES
- 33 1:1 RELATIONSHIP RELATION APPROACH
- 34 ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
- 35 1:N FOREIGN KEY APPROACH
- 36 1:N FOREIGN KEY APPROACH
- 37 ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
- 38 N:M MAPPING TO RELATIONAL
- 39 ACTIVITY
- 40 ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
- 41 MAPPING MULTI-VALUED ATTRIBUTES
- 42 ACTIVITY
- 43 ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
- 44 MAPPING OF N-ARY RELATIONSHIPS
- 45 MAPPING OF N-ARY RELATIONSHIPS
- 46 UNARY RELATIONSHIPS
- 47 1:N UNARY RELATIONSHIPS
- 48 1:N UNARY RELATIONSHIPS (PARTIAL BOTH SIDES)
- 49 M:N UNARY RELATIONSHIPS
- 50 1:N UNARY RELATIONSHIPS (PARTIAL ONE SIDE)
- 51 SUMMARY OF MAPPING CONSTRUCTS AND CONSTRAINTS
- 52 ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
- 53 MAPPING EER MODEL CONSTRUCTS TO RELATIONS
- 54 MAPPING EER MODEL CONSTRUCTS TO RELATIONS
- 55 EXAMPLE: EMPLOYEE AND JOB TYPE
- 56 OPTION 8A: MULTIPLE RELATIONS-SUPERCLASS AND SUBCLASSES
- 57 OPTION 8C: EXTRA ATTRIBUTES
- 58 EXAMPLE: VEHICLE, CAR OR TRUCK
- 59 OPTION 8B: SUB-CLASSES ONLY
- 60 EXAMPLE: PART ENTITY
- 61 OPTION 8D: BOOLEAN FLAGS
- 62 DIFFERENT OPTIONS FOR MAPPING
- 63 Slide 63
- 64 MAPPING OTHER EER MODEL CONSTRUCTS TO RELATIONS
- 65 Slide 65
- 66 RELATIONAL MAPPING
- 67 ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
- 68 Slide 68
- 69 Slide 69
- 70 Slide 70
- 71 ACTIVIT Y
- 72 SOLUTION
- 73 SOLUTION
- 74 FINAL SOLUTION
- 75 ACTIVIT Y
- 76 CHAPTER SUMMARY
WEAK ENTITY TYPES
Notes
Step 2 weak entity: relation with its attributes + the owner’s primary key as a foreign key; PK = owner PK + partial key.
Exam angle
The primary key of a relation mapped from a weak entity is:
DDL BASICS
Notes
CREATE TABLE name (col type constraints, …, PRIMARY KEY (…), FOREIGN KEY (…) REFERENCES other(…));
DDL BASICS (FOREIGN KEYS)
Notes
FOREIGN KEY (Dno) REFERENCES DEPARTMENT(Dnumber) ON DELETE CASCADE / SET NULL.
Exam angle
Which defines a foreign key?
MAPPING OF BINARY 1:1 RELATIONSHIP TYPES
Notes
1:1: three choices. Foreign-key approach (best): put the PK of one side as FK in the side with TOTAL participation. Merged relation (both total). Relationship relation.
Exam angle
For 1:1 MANAGES where DEPARTMENT participates totally, the FK goes in:
- The total side avoids NULLs.
ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
Notes
Memory trick 1:N → the FK goes on the MANY side.
Exam angle
EMPLOYEE (N) works for DEPARTMENT (1). Map it by:
ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
Notes
M:N: a NEW relation with both PKs as FKs; its PK is the combination; relationship attributes go here.
Exam angle
WORKS_ON (M:N, attribute Hours) becomes:
UNARY RELATIONSHIPS
Notes
Unary 1:N: FK to the same table (Super_ssn → EMPLOYEE.Ssn). Unary M:N: new relation with two FKs to the same table.
ER-TO-RELATIONAL MAPPING ALGORITHM (CONTD.)
Notes
Step 8 specialization options: 8A superclass + subclass relations (any case); 8B subclass relations only (total, disjoint); 8C one relation + type attribute (disjoint); 8D one relation + Boolean flags (overlapping).
Exam angle
Mapping option that uses ONE relation with a Boolean flag per subclass suits: