introduction to mis chapter 5 database management systems copyright 1994-1996 by jerry post
Post on 21-Dec-2015
231 views
TRANSCRIPT
Introduction to MISIntroduction to MISChapter 5Chapter 5
Database Management Database Management SystemsSystems
Copyright 1994-1996 by Jerry PostCopyright 1994-1996 by Jerry Post
Database Management Database Management SystemsSystems
Data files
Without a DBMS:Hard to find and share data.
Strategy
Tactics
Operations
Company A
Database
DBMS
Programs
With a DBMS:Integrated data with shared access.
Strategy
Tactics
OperationsCompany B
Database AdvantagesDatabase Advantages
Focus on dataFocus on data– Stable dataStable data– Programs change.Programs change.
Data independenceData independence– Change programs Change programs
without altering data.without altering data.
Data integrityData integrity– Accuracy.Accuracy.– Time.Time.– Concurrency.Concurrency.– Security.Security.
All Data Files
Database ManagementSystem
InvoiceProgram
BillingProgram
Relational DatabasesRelational Databases
TablesTables– RowsRows– ColumnsColumns– Primary keysPrimary keys
Data typesData types– TextText– Dates & Dates &
timestimes– NumbersNumbers– ObjectsObjects
Phone Name Address City312-555-1234 Jones 123 Main Chicago502-555-8876 Smith 456 Oak Glasgow602-555-9987 Juarez 887 Ribera Phoenix612-555-4325 Olsen 465 Thor Minneapolis
Customer Table
Customer Date Salesperson Total_sale502-555-8876 3/3/95 2223 157.92602-555-9987 4/4/94 8876 295.53612-555-4325 4/9/96 8876 132.94502-555-8876 5/7/95 3345 183.67
Orders Table
Multiple TablesMultiple Tables
C# Name Phone City AccountBalance12345 Jones 312-555-1234 Chicago $197.5428764 Adams 602-999-2539 Phoenix $526.7629587 Smitz 206-656-7763 Seattle $353.7644453 Kolke 303-888-8876 Denver $863.3987535 James 305-777-2235 Miami $255.98
Customers
S# Name DateHired Phone Commission225 West 5/23/75 213-333-2345 5452 Zeke 8/15/94 213-343-5553 3554 Jabbar 7/15/91 213-534-8876 4663 Bird 9/12/93 213-225-3335 4887 Johnson 2/2/92 213-887-6635 4
Item# Description Price1154 Corn Broom $1.002254 Blue Jeans $12.003342 Paper Towels--3 rolls $1.007653 Laundry Detergent $2.008763 Men's Boots $15.009987 Candy Popcorn $0.50
O# C# S# Odate Amount117 12345 887 3/3/96 $57.92125 87535 663 4/4/96 $123.54157 12345 554 4/9/96 $297.89169 29587 255 5/5/96 $89.93178 44453 663 5/1/96 $154.89188 29587 554 5/8/96 $325.46201 12345 887 5/28/96 $193.58211 44453 255 6/9/96 $201.39213 44453 255 6/9/96 $154.15215 87535 887 6/9/96 $563.27280 28764 663 5/27/96 $255.32
O# Item# Quantity117 1154 2117 3342 1117 7653 4125 1154 4125 8763 3157 7653 2169 3342 1169 9987 5178 2254 1
Salespeople
Items
Orders
ItemsSold
Linking TablesLinking Tables
The Orders to ItemsSold relationship enforces referential integrity.
One Order can list many ItemsSold.
Database DesignDatabase Design
Primary keysPrimary keys One value per cellOne value per cell Column depends on Column depends on
whole key and whole key and nothing but the key.nothing but the key.
CustomersC# name city home business fax service11 Jones Chicago 111-1111 222-2222 222-35534 876-345622 Smith Chicago 111-4567 444-535333 James Chicago 111-2567 222-897644 Ricci Chicago 333-8765
c# name city11 Jones Chicago22 Smith Chicago33 James Chicago44 Ricci Chicago
Customers(c#, name, city)c# phone_type number11 home 111-111111 business 222-222211 fax 222-353411 service 876-345622 home 111-458722 service 444-535333 home 111-256744 fax 333-8765
Phones(c#, phone_type, number)
Database versusDatabase versus Spreadsheet Spreadsheet
Tables
Customers(C#, Name,Address)
Products(P#, Description, Price)
Sales(O#, P#, Sdate, Quantity, C#)
Part 1 SalesC# P# Q Price Price*Q SubTotal11 22 1 15.95 15.95 15.9511 35 2 5.75 11.50 27.4531 18 1 25.95 25.95 53.40
Part 2 ProductsP# Description Prices18 shorts 25.9522 shirt 15.9535 laces 4.75
Part 3 CustomersC# Name11 Smith31 Torrez
Retrieve the three tables (if they fit).
1) Select by date2) Sort By O#, P#
3) Look up prices
4) Put into Part 1
5) Calculate total
6) Sort for highest total7) Look up names
Storage v calculation Multiple tables
DBMS versus SpreadsheetDBMS versus Spreadsheet
Database QueriesDatabase Queries
Single TableSingle Table ComputationsComputations Joining TablesJoining Tables 1) What output do you want to see?
2) What tables are involved?3) What do you already know? (constraints)4) How are the tables joined?
Four questions to create a query
Single Table Query Single Table Query IntroductionIntroduction
C# Name Phone City AccountBalance28764 Adamz 602-999-2539 Phoenix 197.5487535 James 305-777-2235 Miami 255.9344453 Kolke 303-888-8876 Denver 863.3929587 Smitz 206-676-7763 Seattle 353.76
Sample Data
Query: Which customers have balances greater than $200?
Access Query Screen (QBE)
File: C05E15a.mdb
““AND” Conditions & AND” Conditions & SortingSorting
Sample Data
Query: Which Denver customers have balances greater than $200?
C# Name Phone City AccountBalance28764 Adamz 602-999-2539 Phoenix 197.5487535 James 305-777-2235 Miami 255.9344453 Kolke 303-888-8876 Denver 863.3929587 Smitz 206-676-7763 Seattle 353.76
Access Query Screen (QBE)
Useful WHERE ConditionsUseful WHERE Conditions
ComparisonsComparisons <, =, >, <>, BETWEEN<, =, >, <>, BETWEEN
– NumbersNumbers AccountBalance > 200AccountBalance > 200– TextText
CommonCommon Name > “Jones”Name > “Jones” LIKELIKE
– Match allMatch all Name LIKE “J*”Name LIKE “J*”– Match one Match one Name LIKE “?m*”Name LIKE “?m*”
– DatesDates Odate between #8/15/95# and Odate between #8/15/95# and #8/31/95##8/31/95#
Missing dataMissing data City is NULLCity is NULL NOTNOT Name is NOT NULLName is NOT NULL
ComputationsComputations
SumSum AvgAvg MinMin MaxMax CountCount StDevStDev VarVar
QBE
Groups or SubtotalsGroups or Subtotals
QBE
City AVG(AccountBalance)Chicago 197.54Denver 863.39Miami 255.93Phoenix 526.76Seattle 353.76
Sample Output
Query ExampleQuery Example
Which customers (c#) have placed orders since June 1, 1996?Which customers (c#) have placed orders since June 1, 1996?
QBE
Results
C# Odate44453 6/9/9644453 6/9/9687535 6/9/9628764 6/27/96
Query ExampleQuery Example
What are the What are the names of the names of the customers who customers who placed orders placed orders since June 1, since June 1, 1996?1996?
QBE
Results
Name OdateAdamz 6/27/96James 6/9/96Kolke 6/9/96
Query ExampleQuery Example
List the salespeople (sorted alphabetically) along with the List the salespeople (sorted alphabetically) along with the names of customers who placed orders with that salesperson.names of customers who placed orders with that salesperson.
QBE
Results
SalesName Cust.NameBird AdamzBird JamesBird KolkeJabbar JonesJabbar SmitzJohnson JamesJohnson JonesWest KolkeWest Smitz
Aggregation QueryAggregation Query
What is the total amount of orders placed from customers who live What is the total amount of orders placed from customers who live in Miami?in Miami?
QBE Results
$686.81
DBMS & PeopleDBMS & People
Data
Database ManagementSystem
Program Program
Business Operations
Ad Hoc Queriesand Reports
ProgrammerAnalyst
Database Administrator
Business Needs
Programs& Revisions
Managers
(Standards, Design & Control)
Data Collectionand TransactionProcessing
Database AdministrationDatabase Administration
Database AdministratorDatabase Administrator– TestingTesting– BackupBackup– RecoveryRecovery– StandardsStandards– Access ControlsAccess Controls
DBMS Input ScreenDBMS Input ScreenText/Labels Data Variables
Scrolling Region/Subform
CommandButtons
Record Selectors - Subform - Main
DBMS Report WriterDBMS Report Writer
Report headerReport header Page headerPage header Break/Group headerBreak/Group header DetailDetail FootersFooters
Sample Report with Sample Report with GroupsGroups
Designing Menus for UsersDesigning Menus for Users
1. Setup Choices2. Data Input3. Print Reports4. DOS Utilities5. Backups
Main Menu
Daily Sales ReportsFriday Sales MeetingMonthly Customer Letters
Quit
Customer Information
Which menu is easier to understand?
ObjectsObjects
Hypertext & Massive textHypertext & Massive text Pictures & GraphsPictures & Graphs ObjectsObjects
– VideoVideo– SoundSound– User definedUser defined
Sample OO Sample OO DatabaseDatabase
Patient X-Rays/Images ID
DateTechnician
Comments
Patient Data IDName Address DoB
Medical History
photo Patient VisitsID Date
PhysicianProblems Comments
Patient TreatmentsID Date Procedure Doctor
Massive TextMassive Text
Commercial Commercial DatabasesDatabases
CD-ROMCD-ROM Search StrategiesSearch Strategies
– KeywordsKeywords– Narrow it downNarrow it down– Boolean searchesBoolean searches
Weights (Weights (Verity Verity Topic)Topic)
Smart searchers Smart searchers
Sample Boolean searches:
Colombia
Terrorism
Medellin and (terrorist orterrorism or bombing or kidnap)