Conceptual and Physical Database Design Consideration of Implementation Details
Terminology Entity Field Attribute Record File Key field Primary Key Minimal Combination Candidate Nonkey field Foreign key Secondary key See “Designing Fields,” p. 307.
Entity Relationship Diagrams Entity - represented as a rectangle: Attribute – represented as an oval: Relationship - represented as a diamond:
ERDs (continued) Entity - singular noun Relationship - active verb one-to-one one-to-many many-to-many
ERDs (still more) Cardinality Modality pertains to number pertains to necessity of the entity’s participation in the relationship
Database Design Normalization Progressively restrictive forms Aim: flexibility and elimination of redundancy Note: We will use the standard notation to show tables.
First Normal Form (1NF) 1NF record contains no repeating groups may require use of combination key for primary key see examples in text
Second Normal Form (2NF) 2NF record is already in 1NF, and every field in the record is dependent on the entire primary key. Note that if the primary key of a 1NF record is a single field, then the record is in 2NF. 2NF is desirable to promote database consistency, to reduce overhead in adds, deletes, and changes
Creation of 2NF Records To go from 1NF record with combination key to 2NF, create a new record for each primary key field, then for all combinations of primary key fields; place each remaining field with the appropriate primary key (the minimal key), then eliminate records having no nonkey fields.
Third Normal Form (3NF) A record is in 3NF if it is in 2NF and no nonkey field is dependent on another nonkey field.
Other forms . . . Boyce-Codd Normal Form - slightly more restrictive (stronger) than 3NF if a non-key can determine another non-key, another relation should be formed 4NF - a key determines no more than one set of dependent values 5NF - beyond the scope of this course
More DBMS Terminology DDL Schema Subschema DML SQL QBE tuple Data dictionary DBA data independence consistency redundancy referential integrity relation attribute
Conceptual Database Models Can you name them without looking at the book?
Conceptual Database Models Hierarchical Network Relational Object-oriented
Hierarchical Oldest Parent/child paradigm Disadvantages 1 parent : 1 or many children Disadvantages complex data restructuring is painful
Network Defined by CODASYL Allows modeling of complex relationships Preceded relational model Efficient implementations delayed popular acceptance of relational model. Data restructuring is painful
Relational Simple (relatively speaking) Flexible Some changes to data base structure can be made without restructuring the entire data base. Logical data independence is more readily achieved.
Relational Database Model This is the predominant model today. Database is like a collection of tables (relations).
Object-oriented Relies on OO design Still maturing
Files (terms) block logical record physical record organization access master file transaction file blocking factor buffer
Access Methods Sequential Direct (random) Indexed sequential
File Organizations Sequential Relative Indexed sequential access only random access only Indexed sequential or . . . random
Database and/or File Design DFD is a possible starting point. Entity class diagram is a starting point. Create an ERD. Identify candidate keys. Create 3NF record designs? Consider access frequencies, data volumes, other factors. Consider access methods. Choose a database model and/or determine files. Consider denormalization?