Database Design Chapter 7
Chapter 7: Database Design Introduction An Overview of Databases Steps in Developing a Database Using Resources, Events and Agents Approach Normalization
Introduction Uses of a modern AIS Systematically record data Provide convenient and useful formats Easy access to information
What is a Database? Collection of organized data Used by many different computer applications Manipulated by database management systems (DBMS)
Significance of a Database Critical information Volume Distribution Privacy Irreplaceable data Need for accuracy
Significance of a Database Internet uses Big Data Storing Data in Databases Data Hierarchy
Storing Data in Databases Data must be stored and organized systematically Three important concepts: Three important concepts Data hierarchy Record structures Database keys
Data Hierarchy Data organization in ascending order: Data field Record File Database
Record Structures Example Data fields in each record of a database table Structure is usually fixed Example
Database Keys Primary Key Foreign Keys Unique to each record Enable referencing of one or more records Matches primary key of related table
Records Combined Into Report
Additional Database Issues Administration Database Administrator Documentation Includes a variety of descriptions Structures, Contents, Security Features Data Dictionary Metadata
Data Dictionary Example
Additional Database Issues Data Integrity Data Integrity controls Designed by database developers Processing Accuracy and Completeness Transaction controls Ensures accurate transaction processing
Additional Database Issues Concurrency Concurrency controls Prevent multi-user access at same time Backup and Security Ability to recreate data Prevent unauthorized access View controls
Study Break #1 The part of the data hierarchy that represents one instance of an entity is a: Field Record File Database
Study Break #2 Within the context of databases, the term “concurrency” refers to the possibility that: A customer of one store might also be a customer of another store Two database users might want to access the same record at the same time A credit entry for a customer requires a debit entry for a matching account None of these
REA Model Resources Organization’s assets Events Activities associated with a business process Agents People associated with business activities
Steps in Developing Databases with REA Identify Business and Economic Events Identify Entities Identify Relationships Among Entities
Steps in Developing Databases with REA Create Entity-Relationship Diagrams Identify Attributes of Entities Convert E-R Diagrams into Database Tables
Identify Events and Entities Types of Events Economic Business Types of Database Entities Entities Agents Resources
Entity Examples
Identify Relationships Among Entities Types of Relationships Direct relationship Indirect relationship Cardinalities Nature of relationships among entities
Cardinality Relationships Notations One-to-one (1:1) One-to-many (1:N) Many-to-many (N:N) Purpose Occurrence of one entity Associated with occurrence of one event of another entity
Cardinality Relationships
Entity-Relationship Diagram Purpose Diagram entities Relationships among entities Structure Rectangles represent entities Connecting lines represent relationships
E-R Diagram Example
Relationship Tables Provide greater flexibility Need for Relationship Tables Linking tables with foreign keys Many-to-many relationships
Relationship Tables
Schematic of Database Tables
Study Break #3 In the REA model, the “A” stands for: Agents Additions Accounts Associations
Study Break #4 Which of these is not a cardinality between two database entries? One-to-one None-to-none One-to-many Many-to-many
Normalization Normalization Methodology ensuring attributes are stored in most appropriate tables Design promotes accuracy Avoids redundancy of data storage Levels First normal form Second normal form Third normal form
Unnormalized Data
First Normal Form In First Normal Form (1 NF) when: All data fields are singular Each attribute has one value Problems Data redundancy Insertion anomaly Deletion anomaly
First Normal Form Example
Second Normal Form In Second Normal Form (2 NF) when: It is in 1 NF All data items depend on primary record key Benefits More efficient design Eliminates data redundancy
Second Normal Form Example
Third Normal Form In Third Normal Form (3 NF) when: It is in 2 NF Does not contain transitive dependencies Data field A does not determine data field B Ultimate Goal Create database in 3 NF
Third Normal Form Example
Study Break #5 A database is in third normal form (3 NF) if it is second normal form and: All the data attributes in a record are well-defined All the data attributes in a record depend on the record key The data contains no transitive dependencies The data can be stored in two or more separate tables