Chapter 9 Designing Databases

Slides:



Advertisements
Similar presentations
© 2005 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B.
Advertisements

Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
© 2005 by Prentice Hall Chapter 3a Database Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
IS 4420 Database Fundamentals Chapter 6: Physical Database Design and Performance Leon Chen.
Data Storage Formats Files Databases
CHAPTER 12: Design: Designing Databases 1.1 MSIS 5653 Advanced Systems Development Dursun Delen, Ph.D. Department of Management Oklahoma State University.
Designing Databases Modern Systems Analysis and Design Fifth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Modern Systems Analysis and Design Third Edition
Chapter 9 Designing Databases
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
10-1 Chapter 10 Designing Databases Modern Systems Analysis and Design Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Chapter 6 Physical Database Design. Introduction The purpose of physical database design is to translate the logical description of data into the technical.
1 C omputer information systems Design Instructor: Mr. Ahmed Al Astal IGGC1202 College Requirement University Of Palestine.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 2 Slide 1 Chapter 10 Designing Databases.
Chapter 9 Designing Databases Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Concepts and Terminology Introduction to Database.
TM 7-1 Copyright © 1999 Addison Wesley Longman, Inc. Physical Database Design.
Lecture 12 Designing Databases 12.1 COSC4406: Software Engineering.
10/3/2012ISC329 Isabelle Bichindaritz1 Logical Design.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Chapter 10 Designing Databases Modern Systems Analysis and Design Fifth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
Object-Relational Modeling. What Is a Relational Data Model? Based on the concept of relations (tables of data) Relationships established by matching.
Unit 4 Object Relational Modeling. Key Concepts Object-Relational Modeling outcomes and process Relational data model Normalization Anomalies Functional.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
File and Database Design Class 22. File and database design: 1. Choosing the storage format for each attribute from the logical data model. 2. Grouping.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Essentials of Systems Analysis and Design Fourth Edition Joseph S. Valacich Joey F.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter 9 Designing Databases.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
9-1 © Prentice Hall, 2007 Topic 9: Physical Database Design Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 9 Designing Databases 9.1.
Logical Database Design and the Relational Model.
6-1 © Prentice Hall, 2007 Topic 6: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
8-1 © Prentice Hall, 2007 Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
11-1 © Prentice Hall, 2004 Chapter 11: Physical Database Design Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Logical Design 12/10/2009GAK1. Learning Objectives How to remove features from a local conceptual model that are not compatible with the relational model.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 12 Designing.
Cis339 Modern Systems Analysis and Design Fifth Edition Chapter 10 Designing Databases 10.1.
Chapter 10 Structuring System Requirements: Conceptual Data Modeling
Chapter 8: Object-Relational Modeling
Logical Database Design and the Rational Model
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
Chapter 9 Designing Databases
Physical Database Design
Chapter 5: Logical Database Design and the Relational Model
Physical Database Design and Performance
MIS 322 – Enterprise Business Process Analysis
Modern Systems Analysis and Design Third Edition
Chapter 4 Relational Databases
Translation of ER-diagram into Relational Schema
CHAPTER 5: PHYSICAL DATABASE DESIGN AND PERFORMANCE
Chapter 9 Designing Databases
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
Relational Database.
Chapter 9 Designing Databases
Physical Database Design
Chapter 12 Designing Databases
Chapter 10 Structuring System Requirements: Conceptual Data Modeling
Chapter 10 Designing Databases
Chapter 17 Designing Databases
Presentation transcript:

Chapter 9 Designing Databases Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter 9 Designing Databases 9.1 Copyright 2004 Prentice-Hall, Inc.

Learning Objectives Define each of the following database terms Relation Primary key Functional dependency Foreign key Referential integrity Field Data type Null value Denormalization File organization Index Secondary key 9.2

Learning Objectives Learn how to transform an entity-relationship (ER) Diagram into an equivalent set of well-structured relations Explain choices of storage formats for database fields Learn how to transform well-structured relations into efficient database tables Discuss use of different types of file organizations to store database files 9.3

Process of Database Design Logical Design Based upon the conceptual data model Four key steps 1. Develop a logical data model for each known user interface for the application using normalization principles. 2. Combine normalized data requirements from all user interfaces into one consolidated logical database model 3. Translate the conceptual E-R data model for the application into normalized data requirements 4. Compare the consolidated logical database design with the translated E-R model and produce one final logical database model for the application 9.4

9.5

Process of Database Design Physical Design Based upon results of logical database design Key decisions Choosing storage format for each attribute from the logical database model Grouping attributes from the logical database model into physical records Arranging related records in secondary memory (hard disks and magnetic tapes) so that records can be stored, retrieved and updated rapidly Selecting media and structures for storing data to make access more efficient 9.6

Deliverables and Outcomes Logical database design must account for every data element, system input or output Normalized relations are the primary deliverable Physical database design results in converting relations into files 9.7

Relational Database Model Data represented as a set of related tables or relations Relation A named, two-dimensional table of data. Each relation consists of a set of named columns and an arbitrary number of unnamed rows Properties Entries in cells are simple Entries in columns are from the same set of values Each row is unique The sequence of columns can be interchanged without changing the meaning or use of the relation The rows may be interchanged or stored in any sequence 9.8

Relational Database Model Well-Structured Relation A relation that contains a minimum amount of redundancy and allows users to insert, modify and delete the rows without errors or inconsistencies Primary Key An attribute whose value is unique across all occurrences of a relation 9.9

Normalization The process of converting complex data structures into simple, stable data structures Eliminates redundancy (see Figure 9-6) Normalization Second Normal Form (2NF) Each nonprimary key attribute is identified by the whole key (called full functional dependency) Third Normal Form (3NF) Nonprimary key attributes do not depend on each other (called transitive dependencies) The result of normalization is that every nonprimary key attribute depends upon the whole primary key 9.10

Functional Dependencies and Primary Keys Functional Dependency A particular relationship between two attributes. For a given relation, attribute B is functionally dependent on attribute A if, for every valid value of A, that value of A uniquely determines the value of B Instances (or sample data) in a relation do not prove the existence of a functional dependency Knowledge of problem domain is most reliable method for identifying functional dependency 9.11

Functional Dependencies and Primary Keys Second Normal Form (2NF) A relation is in second normal form (2NF) if any of the following conditions apply: The primary key consists of only one attribute No nonprimary key attributes exist in the relation Every nonprimary key attribute is functionally dependent on the full set of primary key attributes 9.12

Functional Dependencies and Primary Keys Conversion to 2NF To convert a relation into 2NF, decompose the relation into new relations using the attributes, called determinants, that determine other attributes The determinants become the primary key of the new relation 9.13

Functional Dependencies and Primary Keys Third Normal Form (3NF) A relation is in third normal form (3NF) if it is in second normal form (2NF) and there are no functional (transitive) dependencies between two (or more) nonprimary key attributes 9.16

9.17

Problems in Figure 9.9a Functional dependencies beween two nonprimary key attributes Regions depends on Salespersons (??) Salespersons depends on Customer_ID Problems If a new Salesperson is assigned to North region, he can not be entered until a customer (Customer_ID) is assigned to this new Salesperson If Customer_ID = 6837 was deleted from the table, we lost the information that Hernandez was assigned to East region If Smith is reassigned to East region, several rows needs to be changed

Functional Dependencies and Primary Keys Foreign Key An attribute that appears as a nonprimary key attribute in one relation and as a primary key attribute (or part of a primary key) in another relation Foreign key must satisfy referential Integrity An integrity constraint specifying that the value (or existence) of an attribute in one relation depends on the value (or existence) of the same attribute in another relation 9.20

Transforming E-R Diagrams into Relations It is useful to transform the conceptual data model into a set of normalized relations Steps Represent entities Represent relationships Normalize the relations Merge the relations 9.21

Transforming E-R Diagrams into Relations Step 1. Represent Entities Each regular entity is transformed into a relation The identifier of the entity type becomes the primary key of the corresponding relation The primary key must satisfy the following two conditions The value of the key must uniquely identify every row in the relation The key should be nonredundant 9.22

9.23

Transforming E-R Diagrams into Relations Step 2. Represent Relationships Binary 1:N Relationships Add the primary key attribute (or attributes) of the entity on the one side of the relationship as a foreign key in the relation on the right side The one side migrates to the many side 9.24

9.25

Transforming E-R Diagrams into Relations Binary 1:1 or Unary 1:1 Three possible options Add the primary key of A as a foreign key of B Add the primary key of B as a foreign key of A Both Binary and higher M:N relationships Create another relation and include primary keys of all relations as primary key of new relation 9.26

9.27

Transforming E-R Diagrams into Relations Unary 1:N Relationships Relationship between instances of a single entity type Utilize a recursive foreign key A foreign key in a relation that references the primary key values of that same relation 9.28

EMPLOYEE(Emp_ID, Name, Birthdate, Manager_ID) 9.29

Transforming E-R Diagrams into Relations Unary M:N Relationships Create a separate relation Primary key of new relation is a composite of two attributes that both take their values from the same primary key

ITEM(Item_Number, Name, Cost) ITEM_BILL(Item_Number, Component_Number, Quantity) 9.31

Transforming E-R Diagrams into Relations Step 3. Normalize the relations 2NF 3NF

Transforming E-R Diagrams into Relations Step 4. Merging Relations (View Integration) Purpose is to remove redundant relations E.g. EMPLOYEE1(Emp_ID, Address) EMPLOYEE2(Emp_ID, Phone) => EMPLOYEE(Emp_ID, Address, Phone) View Integration Problems Synonyms Two different names used for the same attribute When merging, get agreement from users on a single, standard name STUDENT1(Student_ID, Name) STUDENT2(Matriculation_Number, Name, Address) =>STUDENT(SSN, Name, Address) 9.33

Transforming E-R Diagrams into Relations Homonyms A single attribute name that is used for two or more different attributes Resolved by creating a new name E.g. STUDENT1(Student_ID, Name, Address) STUDENT2(Student_ID, Phone_Number, Address) =>STUDENT(Student_ID, Name, Phone_number, Campus_Address, Permanent_Address)

Transforming E-R Diagrams into Relations Dependencies between nonkeys Dependencies may be created as a result of view integration In order to resolve, the new relation must be normalized E.g. STUDENT1(Student_ID, Major) STUDENT2(Student_ID, Advisor) => STUDENT(Student_ID, Major, Adviser) If 1 major has only 1 adviser, Major->Adviser => STUDENT(Student_ID, Major) & MAJOR ADVISOR(Major, Adviser)

Physical File and Database Design The following information is required Normalized relations, including volume estimates Definitions of each attribute Descriptions of where and when data are used, entered, retrieved, deleted and updated (including frequencies) Expectations or requirements for response time and data integrity Descriptions of the technologies used for implementing the files and database 9.36

Designing Fields Field Choosing data types Data Type Four objectives The smallest unit of named application data recognized by system software Each attribute from each relation will be represented as one or more fields Choosing data types Data Type A coding scheme recognized by system software for representing organizational data Four objectives Minimize storage space Represent all possible values for the field Improve data integrity for the field Support all data manipulations desired on the field Calculated fields A field that can be derived from other database fields 9.37

Methods of Controlling Data Integrity Default Value A value a field will assume unless an explicit value is entered for that field Input Mask A pattern of codes that restricts the width and possible values for each position of a field Range Control Limits range of values which can be entered into field Referential Integrity An integrity constraint specifying that the value (or existence) of an attribute in one relation depends on the value (or existence) of the same attribute in another relation Null Value A special field value, distinct from 0, blank or any other value, that indicates that the value for the field is missing or otherwise unknown 9.38

Figure 9.17a. We will not accept an order from a non-existing customer 9.39

Designing Physical Tables Relational database is a set of related tables Physical Table A named set of rows and columns that specifies the fields in each row of the table Design Goals Efficient use of secondary storage (disk space) Disks are divided into units that can be read in one machine operation Space is used most efficiently when the physical length of a table row divides close to evenly with storage unit Efficient data processing Data are most efficiently processed when stored next to each other in secondary memory 9.40

Designing Physical Tables Denormalization The process of splitting or combining normalized relations into physical tables based on affinity of use of rows and fields (Fig. 9-18a) Optimizes certain operations at the expense of others No hard-and-fast rules to decide when to denormalize data. Three common situations where denormalization may be used Two entities with a one-to-one relationship (Fig. 9-19a) A many-to-many relationship with nonkey attributes (Fig. 9-19b) Reference data (Fig. 9-19c) 9.41

9.42

9.43

9.44

9.45

Designing Physical Tables Arranging Table Rows Physical File A named set of table rows stored in a contiguous section of secondary memory Each table may be a physical file or whole database may be one file, depending on database management software utilized 9.46

Designing Physical Tables File Organization A technique for physically arranging the records of a file Objectives for choosing file organization Fast data retrieval High throughput for processing transactions Efficient use of storage space Protection from failures or data loss Minimizing need for reorganization Accommodating growth Security from unauthorized use 9.47

Designing Physical Tables Types of File Organization Sequential The rows in the file are stored in sequence according to a primary key value Updating and adding records may require rewriting the file Deleting records results in wasted space Indexed The rows are stored either sequentially or nonsequentially and an index is created that allows software to locate individual rows Index A table used to determine the location of rows in a file that satisfy some condition Secondary Index Index based upon a combination of fields for which more than one row may have same combination of values Hashed File Organization The address for each row is determined using an algorithm 9.48

9.49

9.50

9.51

Designing Controls for Files Backup Techniques Periodic backup of files Transaction log or audit trail Change log Data Security Techniques Coding, or encrypting User account management Prohibiting users from working directly with the data. Users work with a copy which updates the files only after validation checks 9.52

Electronic Commerce Application: Designing Databases Design process is no different than for other applications Pine Valley Furniture WebStore 9.53

Summary Key Terms of Database Transforming E-R diagram into well-structured relations View integration Storage formats for database fields Efficient database table design Efficient use of secondary storage Data processing speed File organization Internet development 9.54