Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to MIS1 Copyright © 1998-2002 by Jerry Post Introduction to MIS Chapter 6 Database Management Systems.

Similar presentations


Presentation on theme: "Introduction to MIS1 Copyright © 1998-2002 by Jerry Post Introduction to MIS Chapter 6 Database Management Systems."— Presentation transcript:

1 Introduction to MIS1 Copyright © 1998-2002 by Jerry Post Introduction to MIS Chapter 6 Database Management Systems

2 Introduction to MIS2 Database Management Systems Database DBMS Programs Sales and transaction data Reports and ad hoc queries

3 Introduction to MIS3 Outline Relational Databases Queries Designing a Database Database Applications Database Administration Database and e-Business Cases: Airlines Appendix: Building Forms in Access

4 Introduction to MIS4 DBMS & People Data Database Management System Program Business Operations Ad Hoc Queries and Reports Programmer Analyst Database Administrator Business Needs Programs & Revisions Managers (Standards, Design, and Control) Data Collection and Transaction Processing

5 Introduction to MIS5 PhoneNameAddressCity 312-555-1234Jones123 MainChicago 502-555-8876Smith456 OakGlasgow 602-555-9987Juarez887 RiberaPhoenix 612-555-4325Olsen465 ThorMinneapolis Customer Table CustomerDateSalespersonTotal_sale 502-555-88763/3/042223157.92 602-555-99874/4/048876295.53 612-555-43254/9/048876132.94 502-555-88765/7/043345183.67 Orders Table Relational Databases Tables Rows Columns Primary keys Data types Text Dates & times Numbers Objects

6 Introduction to MIS6 Invoice Program Billing Program file 1 customers file A file B Programming Approach Problems with Programming Data and programs Undocumented files Files & many programs Multiuser Changes

7 Introduction to MIS7 All Data Files Database Management System Invoice Program Billing Program Database Advantages Focus on data Stable data Programs change. Data independence Change programs without altering data. Data integrity Accuracy. Time. Concurrency. Security. Ad hoc queries Speed of development Report writers. Input forms. Data manipulation. Flexibility & Queries

8 Introduction to MIS8 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 Database Queries Single Table Computations Joining Tables

9 Introduction to MIS9 Single Table Query Introduction CIDNamePhoneCityAccountBalance 28764Adamz602-999-2539Phoenix197.54 87535James305-777-2235Miami255.93 44453Kolke303-888-8876Denver863.39 29587Smitz206-676-7763Seattle353.76 Sample Data Access Query Screen (QBE) Query: Which customers have balances greater than $200? File: C05E15a.mdb

10 Introduction to MIS10 AND Conditions and Sorting Sample Data Access Query Screen (QBE) Query: Which Denver customers have balances greater than $200? CIDNamePhoneCityAccountBalance 28764Adamz602-999-2539Phoenix197.54 87535James305-777-2235Miami255.93 44453Kolke303-888-8876Denver863.39 29587Smitz206-676-7763Seattle353.76

11 Introduction to MIS11 SQL Introduction Query: Which customers have balances greater than $200? SQL:SELECTCID, Name, Phone, City, AccountBalance FROMCustomers WHEREAccountBalance > 200 ; Query: Which Denver customers have balances greater than $200? SQL:SELECTCID, City, AccountBalancel FROMCustomers WHEREAccountBalance > 200 and City = Denver ORDER BY Name ASC ; CIDNamePhoneCityAccountBalance 28764Adamz602-999-2539Phoenix197.54 87535James305-777-2235Miami255.93 44453Kolke303-888-8876Denver863.39 29587Smitz206-676-7763Seattle353.76

12 Introduction to MIS12 Useful WHERE Conditions Comparisons, <>, BETWEEN Numbers AccountBalance > 200 Text Common Name > Jones LIKE Match all Name LIKE J* Match one Name LIKE ?m* DatesOdate between #8/15/95# and #8/31/95# Missing dataCity is NULL NOTName is NOT NULL Use with QBE or SQL

13 Introduction to MIS13 SQL General Form SELECTcolumns FROMtables JOINlink columns WHEREconditions GROUP BYcolumn ORDER BYcolumn (ASC | DESC)

14 Introduction to MIS14 Computations Sum Avg Min Max Count StDev Var QBE SELECTCount(C#), AVG(AccountBalance) FROMCustomers ; SQL

15 Introduction to MIS15 Groups or Subtotals QBE SELECTCity, AVG(AccountBalance) FROMCustomers GROUP BYCity ; SQL CityAVG(AccountBalance) Chicago197.54 Denver863.39 Miami255.93 Phoenix526.76 Seattle353.76 Sample Output

16 Introduction to MIS16 Groups with Conditions Query: What is the average account balance for customers from Denver?

17 Introduction to MIS17 Multiple Tables CIDNamePhoneCityAccountBalance 12345Jones312-555-1234Chicago$197.54 28764Adams602-999-2539Phoenix$526.76 29587Smitz206-656-7763Seattle$353.76 44453Kolke303-888-8876Denver$863.39 87535James305-777-2235Miami$255.98 Customers SIDNameDateHiredPhoneCommission 225West5/23/75213-333-23455 452Zeke8/15/94213-343-55533 554Jabbar7/15/91213-534-88764 663Bird9/12/93213-225-33354 887Johnson2/2/92213-887-66354 ItemIDDescriptionPrice 1154Corn Broom$1.00 2254Blue Jeans$12.00 3342Paper Towels--3 rolls$1.00 7653Laundry Detergent$2.00 8763Men's Boots$15.00 9987Candy Popcorn$0.50 OrderIDCIDSIDOdateAmount 117123458873/3/2004$57.92 125875356634/4/2004$123.54 157123455544/9/2004$297.89 169295872555/5/2004$89.93 178444536635/1/2004$154.89 188295875545/8/2004$325.46 201123458875/28/2004$193.58 211444532556/9/2004$201.39 213444532556/9/2004$154.15 215875358876/9/2004$563.27 280287646635/27/2004$255.32 OIDItemIDQuantity 11711542 11733421 11776534 12511544 12587633 15776532 16933421 16999875 17822541 Salespeople Items Orders ItemsSold

18 Introduction to MIS18 Linking Tables The Orders to ItemsSold relationship enforces referential integrity. One Order can list many ItemsSold.

19 Introduction to MIS19 Query Example Which customers (CID) have placed orders since June 1, 2004? QBE SELECTCID, ODate FROMOrders WHEREOdate >= #6/1/2004# ; SQL Results CIDODate 444536/9/2004 875356/9/2004 287646/27/2004

20 Introduction to MIS20 Query Example What are the names of the customers who placed orders since June 1, 2004? QBE SELECTDISTINCT Name, Odate FROMOrders INNER JOIN Customers ON Orders.CID = Customers.CID WHEREOdate >= #6/1/2004# ; SQL Results NameOdate Adamz6/27/2004 James6/9/2004 Kolke6/9/2004

21 Introduction to MIS21 QBE SELECTDISTINCT Salespeople.Name, Customers.Name FROMSalespeople INNER JOIN (Customers INNER JOIN Orders ON Customers.CID=Orders.CID) ON Salespeople.SID = Orders.SID ORDER BY Salespeople.Name ; SQL Results SalesName Cust.Name BirdAdamz BirdJames BirdKolke JabbarJones JabbarSmitz JohnsonJames JohnsonJones WestKolke WestSmitz Query Example List the salespeople (sorted alphabetically) along with the names of customers who placed orders with that salesperson.

22 Introduction to MIS22 Aggregation Query What is the total amount of orders placed from customers who live in Miami? QBE SELECTSUM(Amount) FROMOrders INNER JOIN Customers ON Orders.CID = Customers.CID WHERECity = Miami ; SQL Results $2,418.84

23 Introduction to MIS23 Database Design Primary keys One value per cell Column depends on whole key and nothing but the key. Customers CIDnamecityhomebusinessfaxservice 11JonesChicago111-1111222-2222222-35534876-3456 22SmithChicago111-4567444-5353 33JamesChicago111-2567222-8976 44RicciChicago333-8765 CIDnamecity 11JonesChicago 22SmithChicago 33JamesChicago 44RicciChicago Customers(CID, name, city) CIDphone_typenumber 11home111-1111 11business222-2222 11fax222-3534 11service876-3456 22home111-4587 22service444-5353 33home111-2567 44fax333-8765 Phones(CID, phone_type, number)

24 Introduction to MIS24 Database Design: Normalization File: C05Vid.mdb

25 Introduction to MIS25 Notation Table name Primary key is underlined Table columns Customer (CustomerID, Phone, Name, Address, City, State, ZipCode) CustomerIDPhoneLastNameFirstNameAddressCityStateZipCode 1502-666-7777JohnsonMartha125 Main StreetAlvatonKY42122 2502-888-6464SmithJack873 Elm StreetBowling GreenKY42101 3502-777-7575WashingtonElroy95 Easy StreetSmith's GroveKY42171 4502-333-9494AdamsSamuel746 Brown DriveAlvatonKY42122 5502-474-4746RabitzVictor645 White AvenueBowling GreenKY42102 6615-373-4746SteinmetzSusan15 Speedway DrivePortlandTN37148 7615-888-4474LasaterLes67 S. Ray DrivePortlandTN37148 8615-452-1162JonesCharlie867 Lakeside DriveCastalian SpringsTN37031 9502-222-4351ChavezJuan673 Industry Blvd.CaneyvilleKY42721 10502-444-2512RojoMaria88 Main StreetCave CityKY42127

26 Introduction to MIS26 1st: Repeating RentalForm(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode, (VideoID, Copy#, Title, Rent ) ) Repeating Section Causes duplication TransIDRentDateCustomerIDLastNamePhoneAddressVideoIDCopy#TitleRent 14/18/043Washington502-777-757595 Easy Street122001: A Space Odyssey$1.50 14/18/04 3Washington502-777-757595 Easy Street63Clockwork Orange$1.50 24/30/047Lasater615-888-447467 S. Ray Drive81Hopscotch$1.50 24/30/047Lasater615-888-447467 S. Ray Drive21Apocalypse Now$2.00 24/30/047Lasater615-888-447467 S. Ray Drive61Clockwork Orange$1.50 34/18/048Jones615-452-1162867 Lakeside Drive91Luggage Of The Gods$2.50 34/18/04 8Jones615-452-1162867 Lakeside Drive151Fabulous Baker Boys$2.00 34/18/04 8Jones615-452-1162867 Lakeside Drive41Boy And His Dog$2.50 44/18/043Washington502-777-757595 Easy Street31Blues Brothers$2.00 44/18/04 3Washington502-777-757595 Easy Street81Hopscotch$1.50 44/18/04 3Washington502-777-757595 Easy Street131Surf Nazis Must Die$2.50 44/18/043Washington502-777-757595 Easy Street171Witches of Eastwick$2.00

27 Introduction to MIS27 First Normal Customer Rentals Name Phone Address City State ZipCode VideoIDCopy#TitleRent 1. 61Clockwork Orange1.50 2. 82Hopscotch1.50 3. 4. 5. {Unused Space} Not in First Normal Form

28 Introduction to MIS28 1st: Split RentalForm(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode, (VideoID, Copy#, Title, Rent ) ) RentalForm2(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode) RentalLine(TransID, VideoID, Copy#, Title, Rent ) TransIDRentDateCustomerIDPhoneLastNameFirstNameAddressCityStateZipCode 14/18/043502-777-7575WashingtonElroy95 Easy StreetSmith's GroveKY42171 24/30/047615-888-4474LasaterLes67 S. Ray DrivePortlandTN37148 34/18/048615-452-1162JonesCharlie867 Lakeside DriveCastalian SpringsTN37031 44/18/043502-777-7575WashingtonElroy95 Easy StreetSmith's GroveKY42171 RentalForm2 TransIDVideoIDCopy#TitleRent 1122001: A Space Odyssey$1.50 163Clockwork Orange$1.50 281Hopscotch$1.50 221Apocalypse Now$2.00 261Clockwork Orange$1.50 391Luggage Of The Gods$2.50 3151Fabulous Baker Boys$2.00 341Boy And His Dog$2.50 431Blues Brothers$2.00 481Hopscotch$1.50 4131Surf Nazis Must Die$2.50 4171Witches of Eastwick$2.00 RentalLine Note: replication

29 Introduction to MIS29 2nd Split RentalLine(TransID, VideoID, Copy#, Title, Rent ) VideosRented(TransID, VideoID, Copy# )Videos(VideoID, Title, Rent ) TransIDVideoIDCopy# 112 163 221 261 281 341 391 3151 431 481 4131 4171 VideoIDTitleRent 12001: A Space Odyssey$1.50 2Apocalypse Now$2.00 3Blues Brothers$2.00 4Boy And His Dog$2.50 5Brother From Another Planet$2.00 6Clockwork Orange$1.50 7Gods Must Be Crazy$2.00 8Hopscotch$1.50 Column depends on entire (whole) key.

30 Introduction to MIS30 3rd Split RentalForm2(TransID, RentDate, CustomerID, Phone, Name, Address, City, State, ZipCode ) Rentals(TransID, RentDate, CustomerID ) Customers(CustomerID, Phone, Name, Address, City, State, ZipCode ) TransIDRentDateCustomerID 14/18/04 3 24/30/04 7 34/18/048 44/18/043 CustomerIDPhoneLastNameFirstNameAddressCityStateZipCode 1502-666-7777JohnsonMartha125 Main StreetAlvatonKY42122 2502-888-6464SmithJack873 Elm StreetBowling GreenKY42101 3502-777-7575WashingtonElroy95 Easy StreetSmith's GroveKY42171 4502-333-9494AdamsSamuel746 Brown DriveAlvatonKY42122 5502-474-4746RabitzVictor645 White AvenueBowling GreenKY42102 6615-373-4746SteinmetzSusan15 Speedway DrivePortlandTN37148 7615-888-4474LasaterLes67 S. Ray DrivePortlandTN37148 8615-452-1162JonesCharlie867 Lakeside DriveCastalian SpringsTN37031 9502-222-4351ChavezJuan673 Industry Blvd.CaneyvilleKY42721 10502-444-2512RojoMaria88 Main StreetCave CityKY42127 Rentals Customers

31 Introduction to MIS31 3NF Tables

32 Introduction to MIS32 DBMS Input Screen Text/LabelsData Variables Scrolling Region/Subform Command Buttons Record Selectors - Subform - Main

33 Introduction to MIS33 DBMS Report Writer Report header Page header Break/Group header Detail Footers

34 Introduction to MIS34 Sample Report with Groups

35 Introduction to MIS35 Designing Menus for Users 1. Setup Choices 2. Data Input 3. Print Reports 4. DOS Utilities 5. Backups Main Menu Daily Sales Reports Friday Sales Meeting Monthly Customer Letters Quit Customer Information As a secretary, which menu is easier to understand?

36 Introduction to MIS36 Database Administration Database Administrator Testing Backup Recovery Standards Access Controls

37 Introduction to MIS37 Tables Customers(C#, Name,Address) Products(P#, Description, Price) Sales(O#, P#, Sdate, Quantity, C#) Part 1 Sales C# P# Q Price Price*Q SubTotal 1122115.9515.9515.95 113525.7511.5027.45 3118125.9525.9553.40 Part 2 Products P# DescriptionPrices 18shorts25.95 22shirt15.95 35laces4.75 Part 3 Customers C# Name 11Smith 31Torrez Retrieve the three tables (if they fit). 1) Select by date 2) Sort By O#, P# 3) Look up prices 4) Put into Part 1 5) Calculate total 6) Sort for highest total 7) Look up names Database versus Spreadsheet

38 Introduction to MIS38 u Storage v calculation u Multiple tables DBMS SELECT Sum(Price*Quantity), C#,Name FROM Customers INNER JOIN (Sales INNER JOIN Products ON Sales.P# = Products.P#) ON Customers.C# = Sales.C# WHERE Sdate > Now() - 30 GROUP BY C# ORDER BY Sum(Price*Quantity) DESC; DBMS versus Spreadsheet

39 Introduction to MIS39 Objects Hypertext & Massive text Pictures & Graphs Objects Video Sound User defined

40 Introduction to MIS40 Sample OO Database Patient X-Rays/ImagesID Date Technician Comments Patient DataID NameAddressDoB Medical History photo Patient Visits IDDate Physician ProblemsComments Patient Treatments ID Date Procedure Doctor

41 Introduction to MIS41 E-Business Databases E-business is transaction-based Databases support multiple users and protect transactions Modern websites are driven by databases

42 Introduction to MIS42 E-Business Databases Internet Customer Web Server Web program script Text <% Database connection %> Order Form Descriptions Prices Page request Queries and data Web page

43 Introduction to MIS43 Cases: Airlines

44 Introduction to MIS44 Cases: American Airlines Southwest Airlines What is the companys current status? What is the Internet strategy? How does the company use information technology? What are the prospects for the industry? www.americanair.com www.iflyswa.com

45 Introduction to MIS45 Appendix: Building Forms in Access Begin with the form wizard. Select everything from the Sale table.

46 Introduction to MIS46 Selecting Columns Select additional data from the other tables. But be careful with key columns. For example, do not include the CustomerID from the Customer table or the ItemID from the Item table. Instead, use CustomerID from the Sale table and ItemID from the SaleItem table.

47 Introduction to MIS47 Form Wizard: First Pass The wizard builds the Sale form with a sub form to enter multiple Items being sold. But it needs some work with layout.

48 Introduction to MIS48 Form Design View In design view, you can move the labels and boxes to make the form easier to read. Then, delete the original CustomerID box and use the wizard to add a Combo box to let users select a customer from a list. 1.Lookup values 2.Customer table 3.CustomerID, LastName, FirstName, Phone 4.Store value in: CustomerID

49 Introduction to MIS49 Form Design: Sub Form and SubTotal Edit the subform and add a Combo box for ItemID. Delete the Description box. Add an ItemValue text box to multiply Quantity * List Price. Add a text box to compute the subtotal [=Sum([Quantity]*[ListPrice])]. Be sure to set the correct names and formats in the property window.

50 Introduction to MIS50 Sale Form The final sale form adds a text box that copies the subtotal from the sub form to the main form. Just add a text box and set its value to =[SaleItem Subform].[Form].[SubTotal] and set its name and format properties.


Download ppt "Introduction to MIS1 Copyright © 1998-2002 by Jerry Post Introduction to MIS Chapter 6 Database Management Systems."

Similar presentations


Ads by Google