Chapter 9 Methodology Logical Database Design Chapter 16
Chapter 9 Methodology Logical Database Design Chapter 16 in Textbook
Objectives • Remove features from a local conceptual model that are not compatible with the relational model. • Map the conceptual model into relations. • Validate these relations using the technique of normalization. • Validate a logical data model to ensure it supports required user transactions. • Merge local logical data models based on specific views into a global logical data model of the enterprise. • Ensure that resultant global model is a true and accurate representation of enterprise. Logical DB Design 2
Step 2 Build and Validate Local Logical Data Model Step 2. 1 Remove features not compatible with the relational model Step 2. 2 Derive relations for local logical data model Step 2. 3 Validate relations using normalization Step 2. 4 Validate relations against user transactions Step 2. 5 Define integrity constraints Step 2. 6 Review local logical data model with user Logical DB Design 3
Step 2. 1 Remove features not compatible with the relational model This involves: – remove *: * recursive relationship types; – remove complex relationship types; – remove multi-valued attributes. Logical DB Design 4
Remove *: * Recursive Relationship Types supervisor supervise (0, *) supervisee STAFF (0, *) STAFF Logical DB Design (0, *) supervise (0, *) STAFF 5
Remove Complex Relationship Types BRANCH STAFF register CLIENT BRANCH register REGISTER process STAFF agree CLIENT Logical DB Design 6
Step 2. 2 Derive relations for local logical data model Objective: To create relations for the local logical data model to represent the entities, relationships, and attributes that have been identified. – Strong entity types. – Weak entity types. – 1: 1 binary relationship types. – 1: M relationship types. – 1: 1 recursive relationship types. – Superclass/Subclass relationship types. – M: N relationship types. Document relations and foreign key attributes. Logical DB Design 7
Relations for the Staff View of Dream. Home Staff (staff. No, FName, Lname, position, sex, DOB, Supervisor. Staff. No) Foreign Key Supervisor. Staff. No reference Staff(Staff. No) Business. Owner (Owner. No, BName, Btype, Contact. Name, address, Tel. No) Alternate Key b. Name Alternate Key Tel. No Lease (Lease. No, Payment. Method, deposit. Paid, Rent. Start, Rent. Finish, Client. No, Property. No) Alternate Key Property. No, Rent. Start Foreign Key Client. No refrences Client(Client. No) Foreign Key Property. No refrences Client(Client. No) Derived deposit (Propert. For. Rent. rent * 2) Derived duration (Rent. Finish -Rent. Start) Logical DB Design 8
Step 2 Build and Validate Local Logical Data Model Step 2. 3 Validate relations using normalization Objective: To ensure that each relation is in at least BCNF. Step 2. 4 Validate relations against user transactions Objective: To ensure that the relations in the local logical data model support the transactions required by the view. Logical DB Design 9
Step 2 Build and Validate Local Logical Data Model Step 2. 5 Define integrity constraints Integrity constraints protects DB from being inconsistent. Types of integrity constraints: – Required data. – Entity integrity. – Referential integrity. – Attribute domain. – Enterprise constraints. Logical DB Design 10
Step 2 Build and Validate Local Logical Data Model In testing referential integrity check the following cases: • Insert tuple into child relation. • Delete tuple from child relation. • Update FK of child tuple. • Insert tuple into parent relation. • Delete tuple from parent relation. • Update PK of parent tuple. Logical DB Design 11
Referential Integrity Constraints for Relations Staff (staff. No, FName, Lname, position, sex, DOB, Supervisor. Staff. No) Foreign Key Supervisor. Staff. No reference Staff(Staff. No) ON UPDATE CASCADE ON DELETE SET NULL Business. Owner (Owner. No, BName, Btype, Contact. Name, address, Tel. No) Alternate Key b. Name Alternate Key Tel. No Lease (Lease. No, Payment. Method, deposit. Paid, Rent. Start, Rent. Finish, Client. No, Property. No) Alternate Key Property. No, Rent. Start Foreign Key Client. No refrences Client(Client. No) ON UPDATE CASCADE ON DELETE NO ACTION Foreign Key Property. No refrences Client(Client. No) ON UPDATE CASCADE ON DELETE NO ACTION Derived deposit (Propert. For. Rent. rent * 2) Derived duration (Rent. Finish -Rent. Start) Logical DB Design 12
Step 2 Build and Validate Local Logical Data Model Step 2. 6 Review local logical data model with user Objective: To ensure that the local logical data model and supporting documentation that describes the model is a true representation of the view. Logical DB Design 13
Step 3 Build and validate global logical data model Combine the individual local logical data models into a single global logical data model that represents the enterprise. Step 3. 1 Merge local logical data models into global model Step 3. 2 Validate global logical data model Step 3. 3 Check for future growth Step 3. 4 Review global logical data model with users Logical DB Design 14
Step 3. 1 Merge local logical data models into global model 1. Review the names & contents of entities/relations and their CK. 2. Review the names & contents of relationships/FK. 3. Merge entities/relations from the local models. 4. Include (without merging) entities/relations unique to each local model. 5. Merge relationships/FK from the local models. 6. Include (without merging) relationships/FKs unique to each local model. 7. Check the missing entities/relations and relationships/FKs. 8. Check FKs. 9. Check integrity constraints. 10. Draw the global ER/relation diagram. 11. Update the documentation. 15
1. Review the names & contents of entities/relations and their CK Branch View Entity Type CK Branch Telephone Staff Manager Private. Owner Business. Owner Client Property. For. Rent Lease Logical DB Design Branch. No Post. Code Tel. No Staff. No Owner. No Bname tel. No Client. No Propertyno Lease. No Property. No Rent. Start Client. No, Rent. Start Staff View Entity Type CK Staff. No Private. Owner Business. Owner. No Bname tel. No Owner. No Client. No Propertyno Client. No, Property. No Client Property. For. Rent Viewing 16
2. Review the names & contents of relationships/FK Relation FK Branch View Relationship Branch mgr. Staff. No -> Manager(Staff. No) Telephone branch. N -> Branch(branch. No) Staff supervisor. Staff. No -> Staff(staff. No) Manager branch. No -> Branch(branch. No) Private. Owner Staff. No -> Staff(Staff. No) FK Staff View Relationship Manages Supervisor supervisor. Staff. No -> Staff(staff. No) Supervisor Staff. No -> Staff(Staff. No) Registers Business. Owner Client Property. For. Rent Owner. No -> Private. Owner(owner. No) Owns Owner. No -> Private. Owner(owner. No) POwns Owner. No -> BOwns Business. Owner(owner. No) Viewing Business. Owner(owner. No) Staff. No -> Staff(Staff. No) Oversees Branch. No -> Branch(Branch. No) Offers Logical DB Design Staff. No -> Staff(Staff. No) Manages 17
3. Merge entities/relations from the local models 1. Merge entities/relations with the same name & the same PK. Branch View Staff View PRIVATE OWNER(Ono, name, address) PRIVATE OWNER(Ono, fname, lname, address) Global View PRIVATE OWNER(Ono, fname, lname, address) Logical DB Design 18
3. Merge entities/relations from the local models 2. Merge entities/relations with the same name but different PK. Branch View Staff View BOWNER(b. Name, b. Type, address) BOWNER(Ono, b. Name, b. Type, address) AK tel. No AK b. Name, tel. No Global View BOWNER(Ono, b. Name, b. Type, address) AK b. Name, tel. No 3. Merge entities/relations with the different names using the same or different PK. Logical DB Design 19
4. Include (without merging) entities/relations unique to each local model The Previous task should identify all entities/relations that are the same. All remaining entities/relations are included in the global model without change. Logical DB Design 20
5. Merge relationship/FK from the local models 1. Merge relationship/FKs with the same name & the same purpose. 2. Merge relationship/FKs with different names but the same purpose. Logical DB Design 21
6. Include (without merging) relationships/FKs unique to each local model Again, the Previous task should identify all relationships/FKs that are the same. All remaining relationships/FKs are included in the global model without change. Logical DB Design 22
Step 3 Build and Validate Global Logical Data Model Step 3. 2 Validate global logical data model Objective: To validate the relations created from the global logical data model using the technique of normalization and to ensure they support the required transactions, if necessary. Step 3. 3 Check for future growth Objective: To determine whethere any significant changes likely in the foreseeable future and to assess whether the global logical data model can accommodate these changes. Step 3. 4 Review global logical data model with users Objective: To ensure that the global logical data model is a true representation of the enterprise. Logical DB Design 23
- Slides: 23