chapter 4 database processing copyright © 2013 pearson education, inc. publishing as prentice hall...

37
Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

Upload: randolf-stone

Post on 03-Jan-2016

239 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

Chapter 4

Database ProcessingCopyright © 2013 Pearson Education, Inc.

Publishing as Prentice Hall 4-1

Page 2: Chapter 4 Database Processing Copyright © 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

Page 3: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 4: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 5: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 6: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 7: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 8: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

What are the contents of a database?

• Relational Database

Figure 4-6Examples ofRelationships

Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-8

Page 9: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

What are the contents of a database?

• Metadata– Data that describe data

Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-9

Page 10: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 11: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 12: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 13: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 14: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 15: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 16: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 17: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

8/22/2011 Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 17

Page 18: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

8/22/2011 Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 18

Page 19: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 20: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 21: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

How Do Data Models Facilitate Database Design?

Figure 4-16 Database Design Process

Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-21

Page 22: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 23: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 24: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 25: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 26: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 27: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 28: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 29: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 30: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 31: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 32: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 33: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 34: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 35: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 36: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

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

Page 37: Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1

Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-37