chapter 4 database processing copyright © 2013 pearson education, inc. publishing as prentice hall...
TRANSCRIPT
Chapter 4
Database ProcessingCopyright © 2013 Pearson Education, Inc.
Publishing as Prentice Hall 4-1
Learning Objectives
Q1. What is the purpose of a database?Q2. What are the contents of a database?Q3. What are the components of a database application system?Q4. How do data models facilitate database design?
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-2
Learning Objectives
Q5. How is a data model transformed into a database design?Q6. What is the user’s role in the development of databases?Q7. How can the intramural league improve its database?
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-3
What is the purpose of a database?
• Databases keep track of things• Lists of data and themes– Single theme (concept)• Can be managed using a spreadsheet
– Multiple themes (concepts)• Require databases
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-4
What is the purpose of a database? Figure 4-1 List of Student Grades in a Spreadsheet
Figure 4-2 Student Data in a Form, Data from a Database
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-5
What are the contents of a database?
• Database – self-describing collection of integrated records
• Characters (bytes)• Columns (fields)• Rows (records)• Tables (files)
Figure 4-3 Elements of the StudentTable (also called a file)
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-6
What are the contents of a database?
• What are the relationships among rows?– Key• A value in one row of one table that appears as
a value in another row of another table– Primary key• A value that identifies a unique row in a table
– Foreign key• A value in one table that appears as a primary
key in another table to which it relates
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-7
What are the contents of a database?
• Relational Database
Figure 4-6Examples ofRelationships
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-8
What are the contents of a database?
• Metadata– Data that describe data
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-9
What are the components of a Database Application System?
• Database• DBMS– Create/Administer– Processing Language
• Database Applications
Figure 4-8 Components of a Database Application System
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-10
What are the components of a Database Application System?
• Database v. Database Management Systems (DBMS)– Databases are self-describing collections of
integrated records– DBMS are software used to create, process, and
administer databases
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-11
What are the components of a Database Application System?
• Database Management Systems (DBMS)– Creating the database and its structures– Processing the Database• Read, insert, modify, or delete data • Structured Query Language (SQL)
– Administering the databaseDatabase Administrator (DBA)
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-12
What are the components of a Database Application System?
• Database Management Systems (DBMS)
Figure 4-10 Summary of DatabaseAdministration Tasks
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-13
What are the components of a Database Application System?
• Database Applications– Collection of:• Input For Apps• Report APPS• Query Apps • Application programs
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-14
What are the components of a Database Application System?
• Multi-user Processing– Lost update problem
Figure 4-14 Applications Running on aWeb Server
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-15
What are the components of a Database Application System?
• Categories of DBMS– Enterprise DBMS• 1000’s of users
–Work Group DBMS• Less than 100 users (server systems)
– Personal DBMS• 1 user (personal computers)
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-16
8/22/2011 Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 17
8/22/2011 Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 18
8/22/2011 Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 19
A data dictionary contains data about each file in the database and each field in those files
What are the components of a Database Application System?
• Database• DBMS• Database Application(s)
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-20
How Do Data Models Facilitate Database Design?
Figure 4-16 Database Design Process
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-21
How Do Data Models Facilitate Database Design?
• Entities (Records)– Something users want to track
• Attributes (Fields)– Describe characteristics of entities– Identifier
• Relationships– Entities linked to each other
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-22
How Do Data Models Facilitate Database Design?
• Entity Relationship (E-R) Diagrams– Maximum Cardinality
Figure 4-19Entity Relationships,Diagram Version1
Figure 4-20Entity Relationships,Diagram Version2
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-23
How Do Data Models Facilitate Database Design?
• Entity Relationship (E-R) Diagrams– Maximum and Minimum Cardinality
Figure 4-21Entity Relationships,Diagram Version 3,Minimal CardinalityShown
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-24
How Is a Data Model Transformed into a Database Design?
• Normalization– Converting poorly structured tables into two or
more well-structured tables• Design considerations– 1:N relationships– N:M relationships
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-25
How Is a Data Model Transformed into a Database Design?
• Normalization– Data integrity problems– Normalizing for data integrity
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-26
How Is a Data Model Transformed into a Database Design?
• Design considerations– 1:N relationships– N:M relationships
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-27
What is the User’s Role in the Development of Databases?
• Users are final judges as to the data in the database
• Users should review the data models before developing the database
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-28
How Can the Intramural League Improve Its Database?
• Opening Vignette:– Intramural problems• Process problem (addressed in Chapter 5)• Database problem
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-29
How Can the Intramural League Improve Its Database?
• Database Revision 1– Update “Team” table with “Season” field– Rename the table “Team_Season”
Figure 4-28 League DatabaseRevision 1, Team_Season Table
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-30
How Can the Intramural League Improve Its Database?
• Database Revision 1– Normalizationis needed
Figure 4-30 League E-R DiagramRevision 1
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-31
How Can the Intramural League Improve Its Database?
• Database Revision 2– E-R Diagram
Figure 4-32 League E-R DiagramRevision 2
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-32
How Can the Intramural League Improve Its Database?
• Opening Vignette:– Intramural problems• Process problem (addressed in Chapter 5)• Database problem
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-33
Ethics Guide
• Nobody Said I Shouldn’t– Chris restored his company’s database on his
personal computer– Was this illegal? Unethical? Neither?– Discussion Questions
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-34
Conclusion
Q1. What is the purpose of a database?Q2. What are the contents of a database?Q3. What are the components of a database application system?Q4. How do data models facilitate database design?
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-35
Conclusion
Q5. How is a data model transformed into a database design?Q6. What is the user’s role in the development of databases?Q7. How can the intramural league improve its database?
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-36
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-37