SlideShare a Scribd company logo
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-1
Designing Databases
Modern Systems Analysis
and Design
Eighth Edition, Global Edition
Joseph S. Valacich
Joey F. George
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-2
Learning Objectives
 Describe the database design process, its outcomes,
and the relational database model.
 Describe normalization and the rules for second and
third normal form.
 Transform an entity-relationship (E-R) diagram into an
equivalent set of well-structured (normalized) relations.
 Merge normalized relations from separate user views
into a consolidated set of well-structured relations.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-3
Learning Objectives (Cont.)
 Describe physical database design concepts:
 Choose storage formats for fields in database tables.
 Translate well-structured relations into efficient
database tables.
 Explain when to use different types of file
organizations to store computer files.
 Describe the purpose of indexes and the important
considerations in selecting attributes to be indexed.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-4
Introduction
FIGURE 9-1
Systems development
life cycle with design
phase highlighted
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-5
Database Design
 File and database design occurs in two steps.
1. Develop a logical database model, which describes
data using notation that corresponds to a data
organization used by a database management
system.
 Relational database model
2. Prescribe the technical specifications for computer
files and databases in which to store the data.
 Physical database design provides specifications
 Logical and physical database design in parallel
with other system design steps
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-6
The Process of Database Design
FIGURE 9-2
Relationship between data modeling and the systems development life cycle
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-7
The Process of Database
Design (Cont.)
 Four key steps in logical database modeling
and design:
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 (view integration).
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.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-8
Physical Database Design
 Key physical database design decisions include:
 Choosing a 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.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-9
Relational Database Model
 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
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-10
FIGURE 9-3 (d)
Conceptual data
model and
transformed relations
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-11
Relational Database Model (Cont.)
 Relations have several properties that
distinguish them from nonrelational tables:
 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.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-12
Well-Structured Relation and
Primary Keys
 Well-Structured Relation (or table)
 A relation that contains a minimum amount of redundancy
 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
 All relations have a primary key.
 This is how rows are ensured to be unique.
 A primary key may involve a single attribute or be composed
of multiple attributes.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-13
Well-Structured Relation and
Foreign Keys
 Foreign Key: an attribute that appears as a nonprimary key
attribute (or part of a primary key) in one relation and as a
primary key attribute in another relation
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-14
Normalization and Rules of
Normalization
 Normalization: the process of converting
complex data structures into simple, stable
data structures
 The result of normalization is that every
nonprimary key attribute depends upon the
whole primary key.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-15
Normalization and Rules of
Normalization (Cont.)
 First Normal Form (1NF)
 Unique rows, no multivalued attributes
 All relations are in 1NF
 Second Normal Form (2NF)
 Each nonprimary key attribute is identified by the whole
primary key (called full functional dependency)
 Third Normal Form (3NF)
 Nonprimary key attributes do not depend on each other (i.e.
no transitive dependencies)
15
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-16
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.
The functional dependence of B on A is
represented by A→B.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-17
Functional Dependencies and
Primary Keys (Cont.)
 Functional dependency is not a mathematical
dependency.
 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.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-18
Emp_ID  Name,Dept,Salary (partial dependency)
Emp_ID,Course  Date_Completed (complete
depencency)
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-19
Binary 1:N and 1:1Relationships
(Cont.)
 Binary or Unary 1:1 Relationship is
represented by any of the following
choices:
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 of the above
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-20
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-21
Binary and Higher-Degree M:N
Relationships
 Create another relation and include
primary keys of all relations as primary
key of new relation
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-22
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-23
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.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-24
Representing Entities
 Each regular entity is transformed into a
relation.
 The identifier of the entity type becomes
the primary key of the corresponding
relation.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-25
Representing Entities
 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.
 The entity type label is translated into a
relation name.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-26
Binary 1:N and 1:1Relationships
 The procedure for representing relationships
depends on both the degree of the
relationship—unary, binary, ternary—and the
cardinalities of the relationship.
 Binary 1:N Relationship is represented by
adding the primary key attribute (or attributes)
of the entity on the one side of the
relationship as a foreign key in the relation
that is on the many side of the relationship.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-27
Binary 1:N and 1:1Relationships
(Cont.)
 Binary or Unary 1:1 Relationship is
represented by any of the following
choices:
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 of the above
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-28
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-29
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
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-30
Designing Fields
 Field: the smallest unit of named
application data recognized by system
software
Attributes from relations will be represented as
fields
 Data Type: a coding scheme recognized
by system software for representing
organizational data
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-31
Choosing Data Types
 Selecting a data type balances four
objectives:
Minimize storage space.
Represent all possible values of the field.
Improve data integrity of the field.
Support all data manipulations desired on the
field.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-32
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-33
File Organizations
 File organization: a technique for
physically arranging the records of a file
 Physical file: a named set of table rows
stored in a contiguous section of
secondary memory
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-34
File Organizations (Cont.)
 Three common file organizations:
1. Sequential: rows are stored in sequence
according to a primary key value
2. Indexed: rows can be stored sequentially or
nonsequentially; an index allows quick access
to rows
3. Hashed file organization: rows usually stored
nonsequentially; the address for each row is
determined using an algorithm
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-35
Figure 9-20 Comparison of file organizations
(c) Hashed
(a) Sequential
(b) Indexed
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-36
Summary
 In this chapter you learned how to:
 Describe the database design process, its outcomes,
and the relational database model.
 Describe normalization and the rules for second and
third normal form.
 Transform an entity-relationship (E-R) diagram into
an equivalent set of well-structured (normalized)
relations.
 Merge normalized relations from separate user
views into a consolidated set of well-structured
relations.
Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-37
Summary (Cont.)
 Describe physical database design concepts:
 Choose storage formats for fields in database tables.
 Translate well-structured relations into efficient
database tables.
 Explain when to use different types of file
organizations to store computer files.
 Describe the purpose of indexes and the important
considerations in selecting attributes to be indexed.

More Related Content

PPT
Chapter12 designing databases
PPTX
the normalization of database from APSI Course
PPT
21792 relational database managementsystem
PPT
Chapter 9
PDF
Unit 4 Design_a system analysis and design Designing Database.pdf
PPT
ch02 - Database Environment.ppt chapter 2
PPT
Chapter 4 - normalization.pptjhgfdghjkhg
PPSX
Chapter12 designing databases
the normalization of database from APSI Course
21792 relational database managementsystem
Chapter 9
Unit 4 Design_a system analysis and design Designing Database.pdf
ch02 - Database Environment.ppt chapter 2
Chapter 4 - normalization.pptjhgfdghjkhg

Similar to 03. Design.pptx, it is a very helpful material. (20)

PPT
12 si(systems analysis and design )
PPT
relational model database management system
PPT
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]
PPTX
Chapter 9
PDF
PVP19 DBMS UNIT-4 Material.pdfvh kk ghkd DL of child gf
DOCX
Database DESIGN CONCEPTSDr. Dexter Francis2Data Design
PDF
Modern Systems Analysis and Design 8th Edition Valacich Test Bank
PDF
Dbms 9: Relational Model
PPT
02010 ppt ch02
PPT
Chapter10 conceptual data modeling
DOC
DATA BASE MANAGEMENT SYSTEM - SHORT NOTES
PPT
Data models
PDF
Modern Systems Analysis and Design 8th Edition Valacich Test Bank
PPT
Unit 1
PDF
Modern Systems Analysis and Design 8th Edition Valacich Test Bank
PDF
055240_Data Engineering - Database Design-updated.pdf
PPTX
02 CHAPTER ONE PART II - DATA MODEL AND DBMS ARCHITECTURE.pptx
DOCX
Database Systems Design, Implementation, and Manageme.docx
12 si(systems analysis and design )
relational model database management system
Data Models [DATABASE SYSTEMS: Design, Implementation, and Management]
Chapter 9
PVP19 DBMS UNIT-4 Material.pdfvh kk ghkd DL of child gf
Database DESIGN CONCEPTSDr. Dexter Francis2Data Design
Modern Systems Analysis and Design 8th Edition Valacich Test Bank
Dbms 9: Relational Model
02010 ppt ch02
Chapter10 conceptual data modeling
DATA BASE MANAGEMENT SYSTEM - SHORT NOTES
Data models
Modern Systems Analysis and Design 8th Edition Valacich Test Bank
Unit 1
Modern Systems Analysis and Design 8th Edition Valacich Test Bank
055240_Data Engineering - Database Design-updated.pdf
02 CHAPTER ONE PART II - DATA MODEL AND DBMS ARCHITECTURE.pptx
Database Systems Design, Implementation, and Manageme.docx
Ad

Recently uploaded (20)

PDF
Computing-Curriculum for Schools in Ghana
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Hazard Identification & Risk Assessment .pdf
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PPTX
Computer Architecture Input Output Memory.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
advance database management system book.pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PPTX
Virtual and Augmented Reality in Current Scenario
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Weekly quiz Compilation Jan -July 25.pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Computing-Curriculum for Schools in Ghana
Practical Manual AGRO-233 Principles and Practices of Natural Farming
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
Chinmaya Tiranga quiz Grand Finale.pdf
Hazard Identification & Risk Assessment .pdf
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Computer Architecture Input Output Memory.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
advance database management system book.pdf
Introduction to pro and eukaryotes and differences.pptx
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
Paper A Mock Exam 9_ Attempt review.pdf.
Unit 4 Computer Architecture Multicore Processor.pptx
Virtual and Augmented Reality in Current Scenario
LDMMIA Reiki Yoga Finals Review Spring Summer
Weekly quiz Compilation Jan -July 25.pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Indian roads congress 037 - 2012 Flexible pavement
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Ad

03. Design.pptx, it is a very helpful material.

  • 1. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-1 Designing Databases Modern Systems Analysis and Design Eighth Edition, Global Edition Joseph S. Valacich Joey F. George
  • 2. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-2 Learning Objectives  Describe the database design process, its outcomes, and the relational database model.  Describe normalization and the rules for second and third normal form.  Transform an entity-relationship (E-R) diagram into an equivalent set of well-structured (normalized) relations.  Merge normalized relations from separate user views into a consolidated set of well-structured relations.
  • 3. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-3 Learning Objectives (Cont.)  Describe physical database design concepts:  Choose storage formats for fields in database tables.  Translate well-structured relations into efficient database tables.  Explain when to use different types of file organizations to store computer files.  Describe the purpose of indexes and the important considerations in selecting attributes to be indexed.
  • 4. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-4 Introduction FIGURE 9-1 Systems development life cycle with design phase highlighted
  • 5. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-5 Database Design  File and database design occurs in two steps. 1. Develop a logical database model, which describes data using notation that corresponds to a data organization used by a database management system.  Relational database model 2. Prescribe the technical specifications for computer files and databases in which to store the data.  Physical database design provides specifications  Logical and physical database design in parallel with other system design steps
  • 6. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-6 The Process of Database Design FIGURE 9-2 Relationship between data modeling and the systems development life cycle
  • 7. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-7 The Process of Database Design (Cont.)  Four key steps in logical database modeling and design: 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 (view integration). 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.
  • 8. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-8 Physical Database Design  Key physical database design decisions include:  Choosing a 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. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-9 Relational Database Model  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
  • 10. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-10 FIGURE 9-3 (d) Conceptual data model and transformed relations
  • 11. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-11 Relational Database Model (Cont.)  Relations have several properties that distinguish them from nonrelational tables:  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.
  • 12. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-12 Well-Structured Relation and Primary Keys  Well-Structured Relation (or table)  A relation that contains a minimum amount of redundancy  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  All relations have a primary key.  This is how rows are ensured to be unique.  A primary key may involve a single attribute or be composed of multiple attributes.
  • 13. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-13 Well-Structured Relation and Foreign Keys  Foreign Key: an attribute that appears as a nonprimary key attribute (or part of a primary key) in one relation and as a primary key attribute in another relation
  • 14. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-14 Normalization and Rules of Normalization  Normalization: the process of converting complex data structures into simple, stable data structures  The result of normalization is that every nonprimary key attribute depends upon the whole primary key.
  • 15. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-15 Normalization and Rules of Normalization (Cont.)  First Normal Form (1NF)  Unique rows, no multivalued attributes  All relations are in 1NF  Second Normal Form (2NF)  Each nonprimary key attribute is identified by the whole primary key (called full functional dependency)  Third Normal Form (3NF)  Nonprimary key attributes do not depend on each other (i.e. no transitive dependencies) 15
  • 16. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-16 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. The functional dependence of B on A is represented by A→B.
  • 17. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-17 Functional Dependencies and Primary Keys (Cont.)  Functional dependency is not a mathematical dependency.  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.
  • 18. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-18 Emp_ID  Name,Dept,Salary (partial dependency) Emp_ID,Course  Date_Completed (complete depencency)
  • 19. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-19 Binary 1:N and 1:1Relationships (Cont.)  Binary or Unary 1:1 Relationship is represented by any of the following choices: 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 of the above
  • 20. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-20
  • 21. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-21 Binary and Higher-Degree M:N Relationships  Create another relation and include primary keys of all relations as primary key of new relation
  • 22. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-22
  • 23. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-23 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.
  • 24. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-24 Representing Entities  Each regular entity is transformed into a relation.  The identifier of the entity type becomes the primary key of the corresponding relation.
  • 25. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-25 Representing Entities  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.  The entity type label is translated into a relation name.
  • 26. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-26 Binary 1:N and 1:1Relationships  The procedure for representing relationships depends on both the degree of the relationship—unary, binary, ternary—and the cardinalities of the relationship.  Binary 1:N Relationship is represented by adding the primary key attribute (or attributes) of the entity on the one side of the relationship as a foreign key in the relation that is on the many side of the relationship.
  • 27. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-27 Binary 1:N and 1:1Relationships (Cont.)  Binary or Unary 1:1 Relationship is represented by any of the following choices: 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 of the above
  • 28. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-28
  • 29. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-29 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
  • 30. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-30 Designing Fields  Field: the smallest unit of named application data recognized by system software Attributes from relations will be represented as fields  Data Type: a coding scheme recognized by system software for representing organizational data
  • 31. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-31 Choosing Data Types  Selecting a data type balances four objectives: Minimize storage space. Represent all possible values of the field. Improve data integrity of the field. Support all data manipulations desired on the field.
  • 32. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-32
  • 33. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-33 File Organizations  File organization: a technique for physically arranging the records of a file  Physical file: a named set of table rows stored in a contiguous section of secondary memory
  • 34. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-34 File Organizations (Cont.)  Three common file organizations: 1. Sequential: rows are stored in sequence according to a primary key value 2. Indexed: rows can be stored sequentially or nonsequentially; an index allows quick access to rows 3. Hashed file organization: rows usually stored nonsequentially; the address for each row is determined using an algorithm
  • 35. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-35 Figure 9-20 Comparison of file organizations (c) Hashed (a) Sequential (b) Indexed
  • 36. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-36 Summary  In this chapter you learned how to:  Describe the database design process, its outcomes, and the relational database model.  Describe normalization and the rules for second and third normal form.  Transform an entity-relationship (E-R) diagram into an equivalent set of well-structured (normalized) relations.  Merge normalized relations from separate user views into a consolidated set of well-structured relations.
  • 37. Chapter 9 Copyright © 2017 Pearson Education, Ltd. 9-37 Summary (Cont.)  Describe physical database design concepts:  Choose storage formats for fields in database tables.  Translate well-structured relations into efficient database tables.  Explain when to use different types of file organizations to store computer files.  Describe the purpose of indexes and the important considerations in selecting attributes to be indexed.

Editor's Notes

  • #12: As I said earlier, the main goal of logical database design is to ensure maximal data integrity and minimal data redundancy. If your tables are “well-structured”, this will be the result. That’s what normalization is all about. Often, database designers will attempt to take data that has been stored in lots of spreadsheets and transform these into a database. The spreadsheets are typically not well structured. They have lots of data redundancy, which makes them very difficult to maintain. This is why normalization is so important in database design.
  • #13: As I said earlier, the main goal of logical database design is to ensure maximal data integrity and minimal data redundancy. If your tables are “well-structured”, this will be the result. That’s what normalization is all about. Often, database designers will attempt to take data that has been stored in lots of spreadsheets and transform these into a database. The spreadsheets are typically not well structured. They have lots of data redundancy, which makes them very difficult to maintain. This is why normalization is so important in database design.
  • #18: In figure 9-6 we see a relation (therefore 1st normal form), but this relation includes partial dependencies. Why is that? First, we can tell that it’s a relation. Each row is unique, and none of the attributes have multiple values. Question: Can you discern what the primary key would be here? In other words, what is the smallest set of attribute or attributes that can uniquely identify an EMPLYOEE2 row? Answer: It’s a combination of the employee ID and the course. It’s not the employee ID by itself because we see duplicates of these. It’s also not the course by itself. But you can see there are no two rows with the same combination of employee ID and course. But the problem is, there is a lot of duplicate data in this. For example, we see all the data about employee 100 (name, department, salary) being duplicated. What if the salary changes or the employee is transferred to another department. This would have to be changed in more than one record. We want to avoid that. The problem is caused by partial dependencies. The name, department, and salary are dependent on only part of the primary key (the employee ID). Only the date completed is dependent on the full primary key. The solution in this case is to separate into two tables. One would be an employee table and the other would be the Employee-Course table, as figure 9-7 shows. The relations would look like this: EMPLOYEE(Emp_ID, Name, Dept, Salary) EMPCOURSE(Emp_ID, Course, Date_Completed) The second table has a composite primary key of Emp_ID and Course. EMPCOURSE’s Emp_ID is also a foreign key to EMPLOYEE’s primary key, which implements the one-to-many relationship between the two tables. From a simpler perspective, we can see that the original relation in figure 9-6 was not about a single entity. It was about two entities, the employee and the course taken. A good rule of thumb is to ensure that each relation is about exactly one entity only. In this slide we see the notation of determinants and dependencies. Determinants are the attributes on the left side of the arrow. The attributes on the right side of the arrow are functionally dependent on the determinants.
  • #20: See how simple it is to do this transformation? The relations come directly from the entities. Note the foreign key in the ORDER relation.
  • #22: In this case we actually created an additional relation. There are only two entities in the E-R diagram. But there are three relations. The ORDER LINE relation implements the many-to-many relationship. Any time you have a many-to-many relationship between entities, you need to add another table. Note that ORDER LINE has a composite primary key composed of two foreign keys, one to each of the other tables. Also, since the relationship itself has an attribute, you see this in the ORDER LINE relation. Remember when we talked about associative entities in chapter 8? These are entities that also serve as relationships. Well, we could have represented the same thing in the E-R diagram instead of just a many-to-many relationship. NOTE to instructor: it may be a good exercise to have students redraw the E-R diagram with an associative entity instead of the M:N relationship.
  • #32: Data types are textual, numeric, date, objects such as images, audio files, video files, Word documents, or other possible data formats. We can see similar data types in other database products, such as Microsoft Access, Microsoft SQL Server, MySql (an open source product), or IBM’s DB2.