38
Chapter 5 Database Processing

Ch. 5 - Database Processing

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Ch. 5 - Database Processing

Chapter 5

Database Processing

Page 2: Ch. 5 - Database Processing

Q1: What is the purpose of a database?Q2: What does a database contain?Q3: What is a DBMS and what does it do?Q4: What is a database application?Q5: What is the difference between an

enterprise DBMS and a personal DBMS?

How does the knowledge in this chapter help Dee and you?

Study Questions

5-2Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 3: Ch. 5 - Database Processing

• Dee selected Movable Type application program

• Needs database program to store blog– Consultant suggested MySQL– Network standardized on Oracle

• May not be able to run Movable Type• Will require revision of labor estimates

– IT resists installing MySQL

• Watch video

5-3Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

This Could Happen to You

Page 4: Ch. 5 - Database Processing

• Purpose: To organize and keep track of things• Spreadsheets do that too

– Keeping lists of only a single theme per worksheet• Example: Student test scores in a course

– Linking and managing multiple worksheets is a real pain

• Databases– Keep lists that involve multiple themes– Examples: Student grades, grades for all courses in a

department, courses offered in all departments, faculty records, and so on

• Watch video

Q1: What Is the Purpose of a Database?

5-4Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 5: Ch. 5 - Database Processing

• A self-describing collection of integrated records• Hierarchy of data elements

– Bytes/data are grouped into columns/fields– Columns grouped into rows/records– Rows are grouped into tables/files

• Collection of tables plus relationships among rows – Also includes “metadata”

• Describes the structure of the database and its data

• A database is a structured collection of records stored in a computer system so that a computer program or person using a query language can consult it to answer queries.

5-5Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Q2: What Does a Database Contain?

Page 6: Ch. 5 - Database Processing

Student Table(a.k.a., File)

5-6Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 7: Ch. 5 - Database Processing

• Database have multiple tables (one for each theme)• Values in one table may relate to rows/records in

other tables• Keys

– A column(s) that identify unique row in table– Each table has a key

• Foreign keys– Are keys of a different table than the one in which they

reside

• Relational databases– Databases use tables, keys, and foreign keys to create

relationships

5-7Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Relationships Among Records

Page 8: Ch. 5 - Database Processing

5-8

Example of Relationships Among Three Tables

Figure 5-6

Page 9: Ch. 5 - Database Processing

• Database is self-describing– Contains descriptions of its data

• Metadata– Data that describe data – Makes databases more useful– Makes databases easier to use

• Describes data by: – Data type – text, number, date, etc.– Field name– Field properties

5-9Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Metadata

Page 10: Ch. 5 - Database Processing

Access Metadata Report

5-10Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 11: Ch. 5 - Database Processing

• Database management system (DBMS)– Program that creates, processes, and administers

databases– Usually licensed from vendors– Examples: Microsoft Access, Oracle, MySQL, DB2

• DBMS and database are two different things– Database is a structured collection of records or data

stored in a computer system so a computer program or person using a query language can consult it to answer queries.

– Database management system (DBMS) is a computer program used to manage and query a database

5-11Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Q3: What Is a DBMS and What Does It Do?

Page 12: Ch. 5 - Database Processing

Components of a Database Application System

5-12Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 13: Ch. 5 - Database Processing

• DBMS is used to create tables, relationships in databases

• Applications use a DBMS to read, insert, modify, and delete data– Structured Query Language (SQL)

• International standard language for querying databases

• Allows users to interactively interrogate the database, analyze its data and update it according to the users privileges on data

• Also controls the security of the database

5-13Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Database Management Systems

Page 14: Ch. 5 - Database Processing

Creating the Database and Its Structure

5-14Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 15: Ch. 5 - Database Processing

• DBMS perform four basic operations1. Read data2. Insert data3. Modify data4. Delete data

• Structured Query Language (Example)INSERT INTO Student([Student Number], [Student Name], HW1, HW2, MidTerm)VALUES(1000, ‘Franklin, Benjamin’, 90, 95, 100)

Processing the Database

5-15Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 16: Ch. 5 - Database Processing

• DBMS security features are used to set up user accounts, passwords, permissions, processing limits– Permissions – data access rights for specific users

or groups of users

• Database backup and replication, adding structures, removing unneeded data

Administering the Database

5-16Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 17: Ch. 5 - Database Processing

• Collection of forms, reports, queries, and application programs that process a database

• Databases can have multiple applications

• Applications can have multiple users

5-17Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Q4: What Is a Database Application?

Page 18: Ch. 5 - Database Processing

Use of Multiple Database Applications

5-18Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 19: Ch. 5 - Database Processing

• Forms– Used to read, insert, modify, and delete data

• Reports– Show data in structured context– May compute values such as Totals, within a

report

• Queries– Are a means of getting answers from database

data

5-19Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Forms, Reports, and Queries

Page 20: Ch. 5 - Database Processing

• Application programs – Process logic specific to a business need– May enable database processing over Internet

to:• Serve as intermediary between Web server

and database• Respond to events, • Asks DBMS to read, insert, modify, delete

data

5-20Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Database Application Programs

Page 21: Ch. 5 - Database Processing

Example of a Query

5-21Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 22: Ch. 5 - Database Processing

Four Application Programs on a Web Server Computer

5-22Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 23: Ch. 5 - Database Processing

• Lost-update problem– Occurs when an update made by one transaction is lost due to an

update made by another transaction. 1. Process A reads a customer a record from a file containing account

information, including customer's account balance and phone number.

2. Process B now reads same record from same file, now B has its own copy.

3. Process A changes account balance in its copy of customer record and writes record back to the file.

4. Process B—which still has the original value off account balance in its copy of the customer record—updates customer's phone number and writes customer record back to the file.

5. Process B has now written the old account balance value to the file, causing the changes made by process A to be written over or lost.

5-23Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Multiuser Processing Considerations

Page 24: Ch. 5 - Database Processing

• Preventing Lost Update problems using:• Locking

– Used to ensure that a transaction does not interfere with any other transaction. Locking prevents the problem of lost update, uncommitted data, and inconsistent data.

– By preventing another user or process to open a record that is currenty being used by another user or process.

5-24Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Multiuser Processing Considerations (cont’d)

Page 25: Ch. 5 - Database Processing

• Enterprise DBMS– Processes large organizational and workgroup

databases– Supports many users (thousands plus)– Examples: DB2, SQL Server, Oracle, DB2

• Personal DBMS– Designed for smaller, simpler database applications

– Supports fewer than 100 users (mostly 1-10 users)

– Examples: Access, dBase, FoxPro, Paradox, R-Base

5-25Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Q5: What Is the Difference Between an Enterprise DBMS and a Personal DBMS?

Page 26: Ch. 5 - Database Processing

Personal Database System

5-26Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 27: Ch. 5 - Database Processing

Helps to:

• Know what a DBMS is and what roles it can play

• Understand the diagram (next slide) about role of the DBMS for her blog– Note system will be isolated from rest of databases– Uses MySQL as a functional part of her application

• Explain what she wants, and that it is no threat or exception to Oracle standard

• Maybe avoid hiring a consultant

• Video

5-27Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

How Does the Knowledge in This Chapter Help Dee and You?

Page 28: Ch. 5 - Database Processing

5-28Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Role of DBMS for Dee’s Blog

Page 29: Ch. 5 - Database Processing

• “Take away our customer database,... it would take us 8 years to get back...” At considerable cost

• Database contains everything your customers do• Business disruption costs?• Value of “targeted solicitation”

– Political candidates raised $500,000 in a day with accurate targeted solicitation

– mybarackobama.com

MIS in Use: How Much Is a Database Worth?

5-29Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 30: Ch. 5 - Database Processing

• Kelly was employed maintaining servers and backing up database– Made unauthorized copy of database to practice

with • Queried SQL Server metadata • Discovered tables with order data, customers,

salespeople• Uncovered anomalies: one data entry clerk gave

discounts to a buyer that no other clerks gave discounts to

– Mentioned it to a clerk– Was terminated for accessing the database

5-30Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Ethics Guide: Nobody Said I Shouldn’t

Page 31: Ch. 5 - Database Processing

• Where did Kelly go wrong?• Was it illegal, unethical, or okay for Kelly to copy

the database and take it home?• How could Kelly have handled his discovery of

anomaly and protected himself?• Does Kelly have any legal recourse over being

fired?• How can a business protect its databases from

unauthorized use or duplication?

Ethics Guide: Nobody Said I Shouldn’t (cont’d)

5-31Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 32: Ch. 5 - Database Processing

• Databases take time to build• Complicated to operate

– May require use of multiple applications• Need IS people to create it and keep it running• Will share data that you may not want to expose• Spreadsheets may be a better option in some cases• Is the car salesman’s arguments against keeping his

business data in a database valid?• Would it be better for his employer if all their

salespeople did?

5-32Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Guide: No, Thanks, I’ll Use a Spreadsheet

Page 33: Ch. 5 - Database Processing

Q1: What is the purpose of a database?Q2: What does a database contain?Q3: What is a DBMS, and what does it do?Q4: What is a database application?Q5: What is the difference between an enterprise DBMS and a personal DBMS?How does the knowledge in this chapter help Dee and you?

5-33Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Active Review

Page 34: Ch. 5 - Database Processing

Q1 What is the purpose of a database?• State the purpose of a database. Explain the circumstances in which a database

is preferred to a spreadsheet. Describe the key difference between Figures 5-1 and 5-2.

• Define the term database. Explain the hierarchy of data and the name three elements of a data-base. Define metadata. Using the example of Student and Office_Visit tables, show how relationships among rows are represented in a database. Define the terms key, foreign key, and relational database.

Q2 What does a database contain?• Explain why a database, by itself, is not very useful to business users. Name the

components of a database application system and sketch their relationship. Explain the acronym DBMS and name its functions. List five popular DBMS products. Explain the difference between a DBMS and a database. Summarize the functions of a DBMS. Define SQL. Describe the major functions of database administration.

ACTIVE REVIEW

5-34Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 35: Ch. 5 - Database Processing

• Define the term database. Explain the hierarchy of data and the name three elements of a data-base. Define metadata. Using the example of Student and Office_Visit tables, show how relationships among rows are represented in a database. Define the terms key, foreign key, and relational database.

Q3. What is a DBMS, and what does it do?

5-35Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 36: Ch. 5 - Database Processing

• Name and describe the components of a database application. Explain the need for application programs. For multi-user processing, describe one way in which one user’s work can interfere with another’s. Explain why multi-user database processing involves more than just connecting another computer to the network.

Q4: What is a database application?

5-36Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 37: Ch. 5 - Database Processing

• Define two broad categories of DBMS and explain their differences.

Q5: What is the difference between an enterprise DBMS and a personal DBMS?

5-37Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall

Page 38: Ch. 5 - Database Processing

5-38

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic,

mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America.

Copyright © 2010 Pearson Education, Inc.  Publishing as Prentice Hall