Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 3140 Module 3 – Logical Database Design for the Relational Model Theodore Chiasson Dalhousie University.

Similar presentations


Presentation on theme: "CSCI 3140 Module 3 – Logical Database Design for the Relational Model Theodore Chiasson Dalhousie University."— Presentation transcript:

1 CSCI 3140 Module 3 – Logical Database Design for the Relational Model Theodore Chiasson Dalhousie University

2 Database Design Methodology Design Methodology –A structured approach that uses procedures, techniques, tools, and documentation aids to support and facilitate the process of design Conceptual database design –The process of constructing a model of the information used in an enterprise, independent of all physical considerations Logical database design –The process of constructing a model of the information used in an enterprise based on a specific data model, but independent of a particular DBMS and other physical considerations Physical database design –The process of producing a description of the implementation of the database on secondary storage; it describes the base relations, file organizations, and indexes used to achieve efficient access to the data, and any associated integrity constraints and security measures

3 Logical database design for the relational model Build and validate local logical model for each view For each identified view within the enterprise: –Remove features not compatible with the relational model (optional) –Derive relations for local logical data model –Validate relations using normalization –Validate relations against user transactions –Define integrity constraints –Review local logical data model with user

4 Remove features not compatible with the relational model (optional) The model developed in the Conceptual Design phase may contain some structures that are not easily modeled by conventional relational DBMSs. There are methods for directly mapping these constructs to logical design element. Many-to-many relationships –Insert a new entity between the existing entities, replacing the many-to- many relationship with two one-to-many relationships Many-to-many recursive relationships –Insert a new entity with two relationships to the original entity (each of which are one-to-many relationships) Remove complex relationships –Replace the complex relationship with an entity, and determine the relationship this new entity has with each of the pre-existing entities Remove multi-valued attributes –Insert a new entity with the multi-valued attribute as a single attribute which is the entity’s key

5 Derive relations for local logical data model Strong entity types –Create a relation that includes all of the simple attribute types in the entity Staff(StaffNo, fName, lName, position, sex, DOB) Primary Key (staffNo) Weak entity types –Create a relation that includes all of the simple attribute types in the entity –Primary Key will be defined when relationships are resolved One-to-many (1:*) relationships –Make primary key of the entity on the “1” side a foreign key on the “*” side One-to-one (1:1) relationships –Both mandatory – combine into one entity –One mandatory one optional – place the primary key of the optional participant as a foreign key in the mandatory participant –Both optional – place primary key of one entity as a foreign key in the other entity

6 Derive relations for local logical data model One-to-one (1:1) recursive relationships –Both mandatory Have two copies of the primary key in the one entity (renaming the second copy appropriately) –One mandatory, one optional Either have two copies of the primary key in the one entity (as above), or create a new entity that consists of two copies of the primary key –Both optional Create a new entity as described above Superclass-subclass relationship types –Mandatory, And: single relation –Optional, And: two relations, one for superclass and one for all subclasses –Mandatoy, Or: many relations (one for each combine superclass and subclass) –Optional, Or: many relations (one for superclass, one for each subclass)

7 Derive relations for local logical data model Many to many (*:*) relationship types –Create an entity to represent the relationship –Include all of the simple attributes of the relationship –Include the primary keys of the two entities participating in the relationship These foreign keys make up the primary key for the new entity Complex relationship types –Create an entity to represent the relationship –Include all of the simple attributes of the relationship –Include the primary keys of all of the entities participating in the relationship The foreign keys of entities in a ‘many’ relationship make up the primary key for the new entity Multi-valued attributes –Create a new entity with the multi-valued attribute as key, and include the primary key of the original relation as a foreign key

8 Validate relations using normalization Ensure that all of the relations created are in at least BCNF Validate relations against user transactions Ensure that all of the user transaction are supported by the relations

9 Define integrity constraints Required data –Some attributes must always contain a value (not null) Attribute domain constraints –For example, attribute ‘gender’ is restricted to values “M” and “F” Entity integrity –The primary key of an entity cannot hold Nulls

10 Define integrity constraints Referential integrity –If a foreign key holds a value, the value must match an existing tuple in the parent relation Mandatory – nulls are not allowed Optional – nulls are allowed –Inserting a tuple in child relation Ensure that foreign key is set to nulls or set to a value that matches an existing tuple in the parent relation –Update the foreign key in a child relation Ensure that new value matches an existing tuple in parent relation –Delete tuple from parent relation Referential integrity lost if a child tuple referenced the deleted tuple –No action: Do not allow the delete to succeed –Cascade: automatically delete child tuples that reference the parent –Set null: set the foreign key value in the child tuple to Null –Set default: Set the foreign key value in the child tuple to the default –No check: do nothing to maintain referential integrity

11 Review local logical data model with the user


Download ppt "CSCI 3140 Module 3 – Logical Database Design for the Relational Model Theodore Chiasson Dalhousie University."

Similar presentations


Ads by Google