SlideShare una empresa de Scribd logo
1 de 70
Introduction to MIS

   Chapter 4
   Database Management Systems

   Jerry Post


Technology Toolbox: Creating Forms in Access
Technology Toolbox: Creating Database Reports
Cases: Pharmaceutical Industry
Outline
   How do you store and retrieve the vast amount of
    data collected in a modern company?
   Why is the database management approach so
    important to business?
   How do you write questions for the DBMS to
    obtain data?
   How do you create a new database?
   How do you create business applications using a
    DBMS?
   What tasks need to be performed to keep a
    database running?
   Why are databases so important in e-business?
   How are databases used in cloud computing?
Database Management Systems




           Reports and
                                    Database
           ad hoc queries
                                      DBMS
                                     Programs

            Sales and transaction data
Central Role of DBMS

                                              Database Administrator
Programmer
Analyst
                                            (Standards, Design, and Control)


                                        Data
                    Programs           Database
                    & Revisions       Management
                                        System           Ad Hoc Queries
                                                         and Reports    Managers
                                  Program      Program
   Business Needs
                                      Data Collection
                                      and Transaction
                                      Processing

             Business Operations
Relational Databases
   Tables                            Customer Table
    ◦ Rows              CustomerID    Name        Address      City
    ◦ Columns           12345
                        28764
                                      Jones
                                      Adamz
                                                  125 Elm
                                                  938 Main
                                                               Chicago
                                                               Phoenix
    ◦ Primary keys      29587         Smitz       523 Oak      Seattle
                        33352         Sanchez     999 Pine     Denver
   Data types          44453         Kolke       909 West     Denver
    ◦   Text            87535         James       374 Main     Miami
    ◦   Dates & times
                                         Sales Table
    ◦   Numbers            SaleID    CustomerID   Date     Salesperson
    ◦   Objects            117       12345        3/3/12   887
                           125       87535        4/4/12   663
                           157       12345        4/9/12   554
                           169       29587        5/6/12   255
Database Advantages
   Focus on data
    ◦ Stable data
    ◦ Programs change.
   Data independence
    ◦ Change programs without      All Data Files
      altering data.
   Data integrity
                                Database Management
    ◦   Accuracy.
                                       System
    ◦   Time.
    ◦   Concurrency.            Invoice        Billing
    ◦   Security.               Program       Program
   Ad hoc queries
   Speed of development
    ◦ Report writers.
    ◦ Input forms.
    ◦ Data manipulation.
   Flexibility & Queries
Data Quality: Concurrent Access

                             Customer Accounts
Transaction A                Sanchez: Balance    Transaction B
1) Receive 300 payment
2) Read Balance (500)        Sanchez: 500
                                                 3) New Purchase (350)
                                                 4) Read Balance (500)
5) Subtract payment
6) Store new results (200)   Sanchez: 200
                                                 7) Add purchase
                             Sanchez: 850        8) Store new result (850)
Database Queries

      Four questions to create a query
 1)   What output do you want to see?
 2)   What do you already know? (constraints)
 3)   What tables are involved?
 4)   How are the tables joined?


           Single Table
           Computations
           Joining Tables
Sample Data: Customers

CustomerID Name     Phone          City      AccountBalance
12345     Jones     312-555-1234   Chicago   197.54
28764     Adamz     602-999-2539   Phoenix   526.76
29587     Smitz     206-676-7763   Seattle   353.76
33352     Sanchez   303-444-1352   Denver    153.00
44453     Kolke     303-888-8876   Denver    863.39
87535     James     305-777-2235   Miami     255.93
File: C04E15.mdb




  Single Table Query Introduction
Query: List all of the customers.   Access Query Screen (grid)
Results: Customer Query
Query Conditions
Which customers owe more than $200?
Query Results
Query: AND
Which customers from Denver owe more than $200?
Query Results
Query: OR
List customers from Denver or Chicago.
Query Results
Query: Sorting
List customers from Denver or Chicago, sort the results.
SQL General Form
 SELECT           columns
 FROM       tables
 JOIN       link columns
 WHERE            conditions
 GROUP BY   column
 ORDER BY   column (ASC | DESC)
SQL Introduction
 List all customers.

SQL:    SELECT *
        FROM Customers
SQL: AND Condition

SELECT   Name, Phone, City, AccountBalance
FROM     Customers
WHERE    (AccountBalance>200) AND (City=”Denver”)
SQL: OR Condition

SELECT   Customers.CustomerID, Customers.Name, Customers.Phone,
         Customers.City, Customers.AccountBalance
FROM     Customers
WHERE    (Customers.City = "Denver")
         OR (Customers.City = "Chicago")
Common Query Conditions
Operator   Meaning                Examples
=          Equals                 City=’Denver’
                                  Salary=60000
<          Less than              Salary < 60000
>          Greater than           Sales > 15000
<>         Not equal              City <> ‘Denver’
BETWEEN    Between x and y        SaleDate BETWEEN ‘01-Jan-2012’ AND
                                     ‘28-Feb-2012’
                                  Sales BETWEEN 10000 AND 20000
LIKE       Simple pattern         LastName LIKE ‘J%’
              matching % or *     ProductID LIKE ‘BL_ _DR _ _ _’
              matches any
              characters _ or ?
              matches one
Null       Missing data           City Is Null
NOT        Negation               Not City=’Denver’
Conditions: BETWEEN
List sales in June.




Commonly used for date conditions:
WHERE SaleDate BETWEEN „6/1/2012‟ AND „6/30/2012‟
Query Results
Standard Aggregation Functions
  SUM     total value of items
  AVG     average of values
  MIN     minimum value
  MAX     maximum value
  COUNT   number of rows
  STDEV   standard deviation
  VAR     variance of items
Sample Data: Sales Amount

            Amount
               $197.54
               $526.76
               $353.76
               $153.00
               $863.39
               $255.93
Query: Aggregation




      Count   Avg       Sum
      6       $391.73   $2,350.38
Aggregation Query in Access Grid



                  Click Totals Button

                        Totals Row
Row-by-Row Computations



                                        Type formula
                                        Then change
                                        row heading




      Category    Price       EstCost
    Electronics   $1,000.00       700
    Electronics     $50.00         35
SQL: Aggregation
How many customers are there and want is the average balance?

SELECT     Count(CustomerID) AS NCustomers,
           Avg(AccountBalance) AS AverageOwed
FROM       Customers
SQL: Row-by-Row Calculations
Estimate the cost of clothing items as 70 percent of the price.

    SELECT       Category, Price, 0.7*Price AS EstCost
    FROM         Items
    WHERE        (Category=”Electronics”)
Subtotals: SQL
 How much money is owed by customers in each city?




SELECT City, Sum(AccountBalance) AS SumOfAccountBalance
FROM    Customers
GROUP BY City

             City    SumOfAccountBalance
           Chicago                    $197.54
           Denver                   $1,016.39
           Miami                      $255.93
           Phoenix                    $526.76
           Seattle                    $353.76
Multiple Tables
             Customers                                                   Sales
CID LastName        Phone          City    AccountBalance   SaleID CID      SPID    SaleDate
12345 Jones         312-555-1234   Chicago    $197.54       117 12345       887     3/3/2012
28764 Adamz         602-999-2539   Phoenix    $526.76       125 87535       663     4/4/2012
29587 Smitz         206-656-7763   Seattle    $353.76       157 12345       554     4/9/2012
33352 Sanchez       303-444-1352   Denver     $153.00       169 29587       255     5/5/2012
44453 Kolke         303-888-8876   Denver     $863.39       178 44453       663     5/1/2012
87535 James         305-777-2235   Miami      $255.98       188 29587       554     5/8/2012
                                                            201 12345       887    5/28/2012
                                                            211 44453       255     6/9/2012
            Salespeople                                     213 44453       255    6/10/2012
                                                            215 87535       887     6/9/2012
SPID     LastName    DateHired   Phone      Commission
                                                            280 28764       663    5/27/2012
255      West        5/23/05     213-333-2345  5
                                                            285 28764       887    6/15/2012
452      Thomas      8/15/04     213-343-5553  3
554      Jabbar      7/15/01     213-534-8876  4
663      Bird        9/12/03     213-225-3335  4                         ItemsSold
887      Johnson     2/2/02      213-887-6635  4
                                                                   SaleID    ItemID    Quantity
                                                                   117       1154      2
           Items                                                   117       3342      1
ItemID    Category      Description          Price                 117       7653      4
1154      Shoes         Red Boots            $100.00               125       1154      4
2254      Clothes       Blue Jeans             $12.00              125       8763      3
3342      Electronics   LCD-40 inch         $1,000.00              157       7653      2
7653      Shoes         Blue Suede             $50.00              169       3342      1
8763      Clothes       Mens‟ Work Boots       $45.00              169       9987      5
9987      Electronics   Blu-Ray Player       $400.00               178       2254      1
Linking Tables




  The Sales to ItemsSold relationship enforces referential integrity.
  One Sale can list many ItemsSold.
Query Example
 Which customers (CustomerID) have placed orders since June 1, 2012?

                      SQL        QBE

SELECT CustomerID, SaleDate
FROM   Sales
WHERE SaleDate >= #6/1/2012# ;



                       Results

 CustomerID     SaleDate
 44453          6/9/2012
 44453         6/10/2012
 87535          6/9/2012
 28764         6/15/2012
Query Example
 What are the names of the customers who placed orders since June 1,
 2012?                   SQL
SELECT DISTINCT Customers.CustomerID, Name, SaleDate
FROM    Sales
INNER JOIN Customers
   ON Sales.CustomerID = Customers.CustomerID
WHERE SaleDate >= #6/1/2012# ;
                                                            Grid



              Results

CustomerID     Name     OrderDate
28764          Adamz    6/15/2012
44453          Kolke     6/9/2012
44453          Kolke    6/10/2012
87535          James     6/9/2012
Query Example
             List the salespeople (sorted alphabetically) along with the names of
             customers who placed orders with that salesperson.
 SQL      SELECT DISTINCT Salespeople.Name, Customers.Name
          FROM    Salespeople
          INNER JOIN (Customers INNER JOIN Orders ON
                  Customers.CustomerID=Sales.CustomerID)
                  ON Salespeople.SalespersonID = Sales.SalespersonID
          ORDER BY Salespeople.Name, Customers.Name ;
Results
SalesName Cust.Name           QBE
Bird       Adamz
Bird       James
Bird       Kolke
Jabbar     Jones
Jabbar     Smitz
Johnson    Adamz
Johnson    James
Johnson    Jones
West       Kolke
West       Smitz
Multiple Tables, GROUP
 BY, WHERE
Who are the top salespeople in June?

      Begin by listing the sales in June.
Sales Rows
SalespersonI Name       SaleDat Quantity     Price      Value
     D                      e
         255 West        6/9/201       2 $1,000.0 $2,000.0
                               2                   0          0
       255 West          6/9/201       5     $50.00     $250.00
                               2
       255 West          6/9/201       1     $12.00      $12.00
                               2
       887 Johnso        6/9/201       1
     The quantity and price columns are shown$12.00      $12.00
     temporarily to ensure the computation is specified
             n                 2
     correctly for the Value column.
       887 Johnso        6/9/201       1     $50.00      $50.00
             n                 2
Subtotal in SQL
SELECT Salespeople.SalespersonID, Salespeople.Name,
Sum([Quantity]*[Price]) AS [Value]
FROM Items INNER JOIN ((Salespeople
INNER JOIN Sales
  ON Salespeople.SalespersonID = Sales.SalespersonID)
INNER JOIN ItemsSold
  ON Sales.SalesID = ItemsSold.SaleID)
  ON Items.ItemID = ItemsSold.ItemID
WHERE (Sales.SaleDate Between #6/1/2012# And #6/30/2012#)
GROUP BY Salespeople.SalespersonID, Salespeople.Name
ORDER BY Sum([Quantity]*[Price]) DESC;
Subtotals: Access Grid First Attempt
  Who are the top salespeople in June?




Set the totals and set the Sum column.
Incomplete. See results…
Initial Results
  SalespersonID    Name     SaleDate     Value
       255        West        6/9/2012   $2,250.00
       255        West       6/10/2012     $12.00
       887        Johnson     6/9/2012     $62.00




Salesperson #255 (West) shows up multiple times
because of multiple days. GROUP BY Day,
Salesperson
GROUP BY Conditions: WHERE




Use WHERE instead
of GROUP BY
Best Salesperson Results
 SalespersonID    Name     Value
      255        West      $2,262.00
      887        Johnson     $62.00
Converting Business Questions to
     Queries
1.    What do you want to see?               SELECT
                                             FROM
2.    What constraints are you given?        INNER JOIN
3.    What tables are involved?              WHERE
                                             GROUP BY
4.    How are the tables joined?             ORDER BY

     • Start with the parts you know how to do.
     • Verify the results at each step.
     • Add more tables and columns as needed
     • Do aggregate totals at the end—after verifying the rows.
     • Look for “for each” or “by” to use GROUP BY for subtotals.
Database Design: Normalization
Notation
             Table                                   Table
             name                                    columns


     Customer (CustomerID, LastName, Phone, Street, City, AccountBalance)

             Last                                                 Account
CustomerID           Phone           Street             City
             Name                                                 Balance
     12345 Jones     (312) 555-1234 125 Elm Street      Chicago    $197.54
     28764 Adamz     (602) 999-2539 938 Main Street     Phoenix    $526.76
     29587 Smitz     (206) 676-7763 523 Oak Street      Seattle    $353.76
     33352 Sanchez (303) 444-1352 999 Pine Street       Denver     $153.00
     44453 Kolke     (303) 888-8876 909 West Avenue Denver         $863.39
     87535 James     (305) 777-2235 374 Main Street     Miami      $255.93
1st: Repeating
         SaleForm(SaleID, SaleDate, CustomerID, Phone, Name, Street, (ItemID, Quantity, Description, Price ) )



                                                                                      Repeating Section
                                                                                                   Causes duplication


SaleID   SaleDate    CustomerID   Name    Phone            Street            ItemID   Quantity   Description        Price
  117     3/3/2012        12345   Jones   (312) 555-1234   125 Elm Street     1154          2    Red Boots           $100.00
  117     3/3/2012        12345   Jones   (312) 555-1234   125 Elm Street     3342          1    LCD-40 inch        $1,000.00
  117     3/3/2012        12345   Jones   (312) 555-1234   125 Elm Street     7653          4    Blue Suede           $50.00
  125     4/4/2012        87535   James   (305) 777-2235   374 Main Street    1154          4    Red Boots           $100.00
  125     4/4/2012        87535   James   (305) 777-2235   374 Main Street    8763          3    Men's Work Boots     $45.00
  157     4/9/2012        12345   Jones   (312) 555-1234   125 Elm Street     7653          2    Blue Suede           $50.00
  169     5/6/2012        29587   Smitz   (206) 676-7763   523 Oak Street     3342          1    LCD-40 inch        $1,000.00
  169     5/6/2012        29587   Smitz   (206) 676-7763   523 Oak Street     9987          2    Blu-Ray Player      $400.00
  178     5/1/2012        44453   Kolke   (303) 888-8876   909 West Avenue    2254          1    Blue Jeans           $12.00
  188     5/8/2012        29587   Smitz   (206) 676-7763   523 Oak Street     3342          1    LCD-40 inch        $1,000.00
  188     5/8/2012        29587   Smitz   (206) 676-7763   523 Oak Street     8763          4    Men's Work Boots     $45.00
  201    5/23/2012        12345   Jones   (312) 555-1234   125 Elm Street     1154          1    Red Boots           $100.00
First Normal
 SalesForm with repeating data
SaleID   SaleDate    CustomerID   Name    Phone            Street            ItemID, Quantity, Description, Price
  117     3/3/2012        12345   Jones   (312) 555-1234   125 Elm Street    1154, 2, Red Boots, $100.00
                                                                             3342, 1, LCD-40 inch, $1,000.00
                                                                             7653, 4, Blue Suede, $50.00
  125     4/4/2012        87535   James   (305) 777-2235   374 Main Street   1154, 4, Red Boots, $100,00
                                                                             8763, 3, Men‟s Work Boots, $45.00
  157     4/9/2012        12345   Jones   (312) 555-1234   125 Elm Street    7653, 2, Blue Suede, $50.00
  169     5/6/2012        29587   Smitz   (206) 676-7763   523 Oak Street    3342, 1, LCD-40 inch, $1,000.00
                                                                             9987, 2, Blu-Ray Player, $400.00
  178     5/1/2012        44453   Kolke   (303) 888-8876   909 West Avenue   2254, 1, Blue Jeans, $12.00
  188     5/8/2012        29587   Smitz   (206) 676-7763   523 Oak Street    3342, 1, LCD-40 inch, $1,000.00
                                                                             8763, 1, Men‟s Work Boots, $45.00
  201    5/23/2012        12345   Jones   (312) 555-1234   125 Elm Street    1154, 1, Red Boots, $100.00



                             Not in First Normal Form
1st: Split
              SaleForm(SaleID, SaleDate, CustomerID, Phone, Name, Street, (ItemID, Quantity, Description, Price ) )




SaleForm2(SaleID, SaleDate, CustomerID, Phone, Name, Street)


SaleID   SaleDate    CustomerID   Name    Phone            Street            SaleLine(SaleID, ItemID, Quantity, Description, Price)
  117     3/3/2012        12345   Jones   (312) 555-1234   125 Elm Street
  117     3/3/2012        12345   Jones   (312) 555-1234   125 Elm Street      SaleID   ItemID   Quantity   Description        Price

  117     3/3/2012        12345   Jones   (312) 555-1234   125 Elm Street        117     1154          2    Red Boots            $100.00

  125     4/4/2012        87535   James   (305) 777-2235   374 Main Street       117     3342          1    LCD-40 inch        $1,000.00

  125     4/4/2012        87535   James   (305) 777-2235   374 Main Street       117     7653          4    Blue Suede            $50.00
                                                                                 125     1154          4    Red Boots            $100.00
              Note: replication
                                                                                 125     8763          3    Men's Work Boots      $45.00
                                                                                 157     7653          2    Blue Suede            $50.00
                                                                                 169     3342          1    LCD-40 inch        $1,000.00
                                                                                 169     9987          2    Blu-Ray Player       $400.00
                                                                                 178     2254          1    Blue Jeans            $12.00
                            Note: replication                                    188     3342          1    LCD-40 inch        $1,000.00
                                                                                 188     8763          4    Men's Work Boots      $45.00
                                                                                 201     1154          1    Red Boots            $100.00
2nd Split
Column depends on entire (whole) key.

    SalelLine(SaleID, ItemID, Quantity, Description, Price)


 ItemsSold(SaleID, ItemID, Quantity )
                                            Items(ItemID, Description, Price)
    SaleID   ItemID   Quantity
                                           ItemID   Description        Price
       117    1154          2
                                             1154   Red Boots           $100.00
       117    3342          1
                                             2254   Blue Jeans           $12.00
       117    7653          4
                                             3342   LCD-40 inch        $1,000.00
       125    1154          4
                                             7653   Blue Suede           $50.00
       125    8763          3
                                             8763   Men's Work Boots     $45.00
       157    7653          2
                                             9987   Blu-Ray Player      $400.00
       169    3342          1
       169    9987          2
       178    2254          1
       188    3342          1
3rd Split
    SaleForm2(SaleID, SaleDate, CustomerID, Phone, Name, Street)


Sales(SaleID, SaleDate, CustomerID )
SaleID   SaleDate   CustomerID   SalespersonID
  117    3/3/2012        12345                887
  125    4/4/2012        87535                663
  157    4/9/2012        12345                554
  169    5/6/2012        29587                255
  178    5/1/2012        44453                663
  188    5/8/2012        29587                554

                                  Customers(CustomerID, Phone, Name, Address, City, State, ZipCode)
                                 CustomerID     Name      Phone            Street            City      AccountBalance
                                      12345     Jones     (312) 555-1234   125 Elm Street    Chicago          $197.54
                                      28764     Adamz     (602) 999-2539   938 Main Street   Phoenix          $526.76
                                      29587     Smitz     (206) 676-7763   523 Oak Street    Seattle          $353.76
                                      33352     Sanchez   (303) 444-1352   999 Pine Street   Denver           $153.00
                                      44453     Kolke     (303) 888-8876   909 West Avenue   Denver           $863.39
                                      87535     James     (305) 777-2235   374 Main Street   Miami            $255.93
3NF Tables
DBMS Input Screen
        Text/Labels        Data Variables




                                                               Command
                                                               Buttons




                                            Record Selectors
Scrolling Region/Subform                      - Subform
                                              - Main
DBMS Report Writer
     Report header
     Page header
     Break/Group header
     Detail
     Footers
Sample Report
with Groups
Designing Menus for Users

       Main Menu                      Customer Information
 1.   Setup Choices            Daily Sales Reports
 2.   Data Input               Friday Sales Meeting
 3.   Print Reports            Monthly Customer Letters
 4.   DOS Utilities
 5.   Backups                  Quit




  As a secretary, which menu is easier to understand?
Database Administration
   Database Administrator
    ◦   Testing
    ◦   Backup
    ◦   Recovery
    ◦   Standards
    ◦   Access Controls
E-Business Databases
 E-business is transaction-based
 Databases support multiple users and
  protect transactions
 Modern websites are driven by
  databases
E-Business Databases

                                SQL


                      Results         Database Server

         Web Server
Web program script
<HTML>
Text
Data
</HTML>
                            Order Form

                            Descriptions
                            Prices
                                                        Customer
Cloud Computing with Databases
Google: BigTable, developed for internal storage
         AppEngine: http://code.google.com/appengine/
         Best for complex documents/objects
         It is not SQL; no JOINs
         Three keys: Row, Column, Time/version
Generic: Hadoop (Apache)

Amazon:
          S3    Files, particularly large media files
                http://aws.amazon.com/s3/
         SimpleDB         Similar to BigTable
                http://aws.amazon.com/simpledb/
         RDS    Relational data service
                MySQL or Oracle 11g
                http://aws.amazon.com/rds/
Microsoft:
         Azure SQL Server
                http://www.microsoft.com/windowsazure/
Cloud Database Service Benefits
   No fixed costs
    ◦ No hardware or software
    ◦ No maintenance
    ◦ Easy administration
   Pricing based on usage
    ◦ Monthly data storage (size)
    ◦ Monthly data transfer (usage)
   Scalable
    ◦ Multiple, distributed servers
    ◦ Multiple, high-speed Internet connections
   Reliable
    ◦ Distributed
    ◦ Run by experts
    ◦ Security monitoring
Cloud Database Limits
 Costs increase based on usage
 At some point, it might be cheaper to
  buy and run everything yourself
 Not pay profit/overhead to third-party
 But be sure to measure all fixed costs
Cloud Database Pricing
Example: Amazon RDS (MySQL), U.S. East
   1 Extra large instance
   20 hours/day
   20 GB/month at 50 million I/O per month
   10 GB/month data transfer in        All values are estimates and
   500 GB/month data transfer out      might not include all fees.
   20 GB/month regional transfer
   => $616 per month ($7400/year)
Example: Microsoft SQLAzure Business Edition
   1 Extra large instance ($0.96/hour = $576/month)
   20 GB/month ($200/month)
   10 GB/month data transfer in ($1/month)
   500 GB/month data transfer out ($75/month)
   => $852 per month ($10,224/year)

  You get a relatively large database with T1-level data transfer for
  less than 10 percent of the cost of a DBA.
Technology Toolbox: Building Forms in
Access
1.   Start the Form Wizard
2.   Select the SalesTable, all columns
3.   Customer Table: Phone
4.   ItemsSold, all columns except SaleID
5.   Product Table, Category
6.   Design View, rearrange, add Combo boxes
Quick Quiz: Forms in Access
1. Create a simple customer form and enter data to test it.
2. Create a basic order form and add a combo box to
   select customers.
Technology Toolbox: Creating Database
 Reports
1. Start the Report Wizard
2. Select the columns for the report: CustomerID,
   Name, Phone, SaleDate, Description, Price, Quantity
3. Choose a layout
4. Click Summary Options to sum Quantity
5. Use Design View to clean up the layout and format
6. Add a text box for Value: =Price*Quantity
7. Edit the Sums to use the same calculation
Quick Quiz: Creating a Report
1. Create a report that prints all of the items ordered by
   each customer.
2. Create a report that prints each customer, followed by
   the orders for that customer.
3. Create a report that displays a chart of total sales by
   customer.
Cases: Pharmaceuticals
                                                               Annual Revenue
                80
                70
                60
                50                                                                                           Pfizer
   Billion $




                40                                                                                           GlaxoSmithKline
                30                                                                                           Bristol-Myers Squibb

                20                                                                                           Eli Lilly

                10
                 0
                      1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010




                                                           Net Income / Revenue
               0.6

               0.5

               0.4

               0.3                                                                                           Pfizer
Ratio




                                                                                                             GlaxoSmithKline
               0.2
                                                                                                             Bristol-Myers Squibb
               0.1                                                                                           Eli Lilly
                 0
                      1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
               -0.1

               -0.2

Más contenido relacionado

Destacado

Communication arts 101
Communication arts 101Communication arts 101
Communication arts 101Lee Gomez
 
3e - Security And Privacy
3e - Security And Privacy3e - Security And Privacy
3e - Security And PrivacyMISY
 
Avail beauty presentation updated v2
Avail beauty presentation updated v2Avail beauty presentation updated v2
Avail beauty presentation updated v2Lee Gomez
 

Destacado (8)

Mis07
Mis07Mis07
Mis07
 
Mis08
Mis08Mis08
Mis08
 
Communication arts 101
Communication arts 101Communication arts 101
Communication arts 101
 
3e - Security And Privacy
3e - Security And Privacy3e - Security And Privacy
3e - Security And Privacy
 
Mis05
Mis05Mis05
Mis05
 
Mis06
Mis06Mis06
Mis06
 
Avail beauty presentation updated v2
Avail beauty presentation updated v2Avail beauty presentation updated v2
Avail beauty presentation updated v2
 
Mis01
Mis01Mis01
Mis01
 

Similar a Mis04

L’architettura di classe enterprise di nuova generazione
L’architettura di classe enterprise di nuova generazioneL’architettura di classe enterprise di nuova generazione
L’architettura di classe enterprise di nuova generazioneMongoDB
 
Overview of business intelligence
Overview of business intelligenceOverview of business intelligence
Overview of business intelligenceAhsan Kabir
 
Data+Modelling.pptx
Data+Modelling.pptxData+Modelling.pptx
Data+Modelling.pptxssuser58c23b
 
Data+Modelling.pptx
Data+Modelling.pptxData+Modelling.pptx
Data+Modelling.pptxssuser58c23b
 
Introduction: Relational to Graphs
Introduction: Relational to GraphsIntroduction: Relational to Graphs
Introduction: Relational to GraphsNeo4j
 
MongoDB Europe 2016 - The Rise of the Data Lake
MongoDB Europe 2016 - The Rise of the Data LakeMongoDB Europe 2016 - The Rise of the Data Lake
MongoDB Europe 2016 - The Rise of the Data LakeMongoDB
 
Microsoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMicrosoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMark Kromer
 
From SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSONFrom SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSONKeshav Murthy
 
Recom Banking Solution
Recom Banking  SolutionRecom Banking  Solution
Recom Banking Solutionjagishar
 
Mastering Customer Data on Apache Spark
Mastering Customer Data on Apache SparkMastering Customer Data on Apache Spark
Mastering Customer Data on Apache SparkCaserta
 
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
2-1 Remember the Help Desk with AFCU - Jared Flanders, FinalJared Flanders
 
Data Virtualization for Data Architects (Australia)
Data Virtualization for Data Architects (Australia)Data Virtualization for Data Architects (Australia)
Data Virtualization for Data Architects (Australia)Denodo
 
L’architettura di Classe Enterprise di Nuova Generazione
L’architettura di Classe Enterprise di Nuova GenerazioneL’architettura di Classe Enterprise di Nuova Generazione
L’architettura di Classe Enterprise di Nuova GenerazioneMongoDB
 
Relational Model in NoSQL Article.pptx
Relational Model in NoSQL Article.pptxRelational Model in NoSQL Article.pptx
Relational Model in NoSQL Article.pptxClaudioCordova10
 
PowerBI importance of power bi in data analytics field
PowerBI importance of power bi in data analytics fieldPowerBI importance of power bi in data analytics field
PowerBI importance of power bi in data analytics fieldshubham299785
 
No SQL, No Problem: Use Azure DocumentDB
No SQL, No Problem: Use Azure DocumentDBNo SQL, No Problem: Use Azure DocumentDB
No SQL, No Problem: Use Azure DocumentDBKen Cenerelli
 
Refactoring for microservices
Refactoring for microservicesRefactoring for microservices
Refactoring for microservicesIsmael Rivera
 
Big Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft AzureBig Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft AzureMark Kromer
 
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it tooQuerying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it tooAll Things Open
 

Similar a Mis04 (20)

L’architettura di classe enterprise di nuova generazione
L’architettura di classe enterprise di nuova generazioneL’architettura di classe enterprise di nuova generazione
L’architettura di classe enterprise di nuova generazione
 
Overview of business intelligence
Overview of business intelligenceOverview of business intelligence
Overview of business intelligence
 
Data+Modelling.pptx
Data+Modelling.pptxData+Modelling.pptx
Data+Modelling.pptx
 
Data+Modelling.pptx
Data+Modelling.pptxData+Modelling.pptx
Data+Modelling.pptx
 
Introduction: Relational to Graphs
Introduction: Relational to GraphsIntroduction: Relational to Graphs
Introduction: Relational to Graphs
 
MongoDB Europe 2016 - The Rise of the Data Lake
MongoDB Europe 2016 - The Rise of the Data LakeMongoDB Europe 2016 - The Rise of the Data Lake
MongoDB Europe 2016 - The Rise of the Data Lake
 
Microsoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMicrosoft Azure Big Data Analytics
Microsoft Azure Big Data Analytics
 
From SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSONFrom SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSON
 
Recom Banking Solution
Recom Banking  SolutionRecom Banking  Solution
Recom Banking Solution
 
Mastering Customer Data on Apache Spark
Mastering Customer Data on Apache SparkMastering Customer Data on Apache Spark
Mastering Customer Data on Apache Spark
 
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
 
Data Virtualization for Data Architects (Australia)
Data Virtualization for Data Architects (Australia)Data Virtualization for Data Architects (Australia)
Data Virtualization for Data Architects (Australia)
 
L’architettura di Classe Enterprise di Nuova Generazione
L’architettura di Classe Enterprise di Nuova GenerazioneL’architettura di Classe Enterprise di Nuova Generazione
L’architettura di Classe Enterprise di Nuova Generazione
 
1120 track2 komp
1120 track2 komp1120 track2 komp
1120 track2 komp
 
Relational Model in NoSQL Article.pptx
Relational Model in NoSQL Article.pptxRelational Model in NoSQL Article.pptx
Relational Model in NoSQL Article.pptx
 
PowerBI importance of power bi in data analytics field
PowerBI importance of power bi in data analytics fieldPowerBI importance of power bi in data analytics field
PowerBI importance of power bi in data analytics field
 
No SQL, No Problem: Use Azure DocumentDB
No SQL, No Problem: Use Azure DocumentDBNo SQL, No Problem: Use Azure DocumentDB
No SQL, No Problem: Use Azure DocumentDB
 
Refactoring for microservices
Refactoring for microservicesRefactoring for microservices
Refactoring for microservices
 
Big Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft AzureBig Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft Azure
 
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it tooQuerying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
Querying NoSQL with SQL: HAVING Your JSON Cake and SELECTing it too
 

Más de Lee Gomez

February 15, 2024 - One Year Experiencing God's Presence Devotional
February 15, 2024 - One Year Experiencing God's Presence DevotionalFebruary 15, 2024 - One Year Experiencing God's Presence Devotional
February 15, 2024 - One Year Experiencing God's Presence DevotionalLee Gomez
 
The Lord's Supper celebration and worship
The Lord's Supper celebration and worshipThe Lord's Supper celebration and worship
The Lord's Supper celebration and worshipLee Gomez
 
MIS Chapter 3
MIS Chapter 3MIS Chapter 3
MIS Chapter 3Lee Gomez
 
MIS - Chapter 02
MIS - Chapter 02MIS - Chapter 02
MIS - Chapter 02Lee Gomez
 
Communication Arts 101
Communication Arts 101Communication Arts 101
Communication Arts 101Lee Gomez
 
Communication arts 101
Communication arts 101Communication arts 101
Communication arts 101Lee Gomez
 

Más de Lee Gomez (6)

February 15, 2024 - One Year Experiencing God's Presence Devotional
February 15, 2024 - One Year Experiencing God's Presence DevotionalFebruary 15, 2024 - One Year Experiencing God's Presence Devotional
February 15, 2024 - One Year Experiencing God's Presence Devotional
 
The Lord's Supper celebration and worship
The Lord's Supper celebration and worshipThe Lord's Supper celebration and worship
The Lord's Supper celebration and worship
 
MIS Chapter 3
MIS Chapter 3MIS Chapter 3
MIS Chapter 3
 
MIS - Chapter 02
MIS - Chapter 02MIS - Chapter 02
MIS - Chapter 02
 
Communication Arts 101
Communication Arts 101Communication Arts 101
Communication Arts 101
 
Communication arts 101
Communication arts 101Communication arts 101
Communication arts 101
 

Mis04

  • 1. Introduction to MIS Chapter 4 Database Management Systems Jerry Post Technology Toolbox: Creating Forms in Access Technology Toolbox: Creating Database Reports Cases: Pharmaceutical Industry
  • 2. Outline  How do you store and retrieve the vast amount of data collected in a modern company?  Why is the database management approach so important to business?  How do you write questions for the DBMS to obtain data?  How do you create a new database?  How do you create business applications using a DBMS?  What tasks need to be performed to keep a database running?  Why are databases so important in e-business?  How are databases used in cloud computing?
  • 3. Database Management Systems Reports and Database ad hoc queries DBMS Programs Sales and transaction data
  • 4. Central Role of DBMS Database Administrator Programmer Analyst (Standards, Design, and Control) Data Programs Database & Revisions Management System Ad Hoc Queries and Reports Managers Program Program Business Needs Data Collection and Transaction Processing Business Operations
  • 5. Relational Databases  Tables Customer Table ◦ Rows CustomerID Name Address City ◦ Columns 12345 28764 Jones Adamz 125 Elm 938 Main Chicago Phoenix ◦ Primary keys 29587 Smitz 523 Oak Seattle 33352 Sanchez 999 Pine Denver  Data types 44453 Kolke 909 West Denver ◦ Text 87535 James 374 Main Miami ◦ Dates & times Sales Table ◦ Numbers SaleID CustomerID Date Salesperson ◦ Objects 117 12345 3/3/12 887 125 87535 4/4/12 663 157 12345 4/9/12 554 169 29587 5/6/12 255
  • 6. Database Advantages  Focus on data ◦ Stable data ◦ Programs change.  Data independence ◦ Change programs without All Data Files altering data.  Data integrity Database Management ◦ Accuracy. System ◦ Time. ◦ Concurrency. Invoice Billing ◦ Security. Program Program  Ad hoc queries  Speed of development ◦ Report writers. ◦ Input forms. ◦ Data manipulation.  Flexibility & Queries
  • 7. Data Quality: Concurrent Access Customer Accounts Transaction A Sanchez: Balance Transaction B 1) Receive 300 payment 2) Read Balance (500) Sanchez: 500 3) New Purchase (350) 4) Read Balance (500) 5) Subtract payment 6) Store new results (200) Sanchez: 200 7) Add purchase Sanchez: 850 8) Store new result (850)
  • 8. Database Queries Four questions to create a query 1) What output do you want to see? 2) What do you already know? (constraints) 3) What tables are involved? 4) How are the tables joined?  Single Table  Computations  Joining Tables
  • 9. Sample Data: Customers CustomerID Name Phone City AccountBalance 12345 Jones 312-555-1234 Chicago 197.54 28764 Adamz 602-999-2539 Phoenix 526.76 29587 Smitz 206-676-7763 Seattle 353.76 33352 Sanchez 303-444-1352 Denver 153.00 44453 Kolke 303-888-8876 Denver 863.39 87535 James 305-777-2235 Miami 255.93
  • 10. File: C04E15.mdb Single Table Query Introduction Query: List all of the customers. Access Query Screen (grid)
  • 12. Query Conditions Which customers owe more than $200?
  • 14. Query: AND Which customers from Denver owe more than $200?
  • 16. Query: OR List customers from Denver or Chicago.
  • 18. Query: Sorting List customers from Denver or Chicago, sort the results.
  • 19. SQL General Form  SELECT columns  FROM tables  JOIN link columns  WHERE conditions  GROUP BY column  ORDER BY column (ASC | DESC)
  • 20. SQL Introduction List all customers. SQL: SELECT * FROM Customers
  • 21. SQL: AND Condition SELECT Name, Phone, City, AccountBalance FROM Customers WHERE (AccountBalance>200) AND (City=”Denver”)
  • 22. SQL: OR Condition SELECT Customers.CustomerID, Customers.Name, Customers.Phone, Customers.City, Customers.AccountBalance FROM Customers WHERE (Customers.City = "Denver") OR (Customers.City = "Chicago")
  • 23. Common Query Conditions Operator Meaning Examples = Equals City=’Denver’ Salary=60000 < Less than Salary < 60000 > Greater than Sales > 15000 <> Not equal City <> ‘Denver’ BETWEEN Between x and y SaleDate BETWEEN ‘01-Jan-2012’ AND ‘28-Feb-2012’ Sales BETWEEN 10000 AND 20000 LIKE Simple pattern LastName LIKE ‘J%’ matching % or * ProductID LIKE ‘BL_ _DR _ _ _’ matches any characters _ or ? matches one Null Missing data City Is Null NOT Negation Not City=’Denver’
  • 24. Conditions: BETWEEN List sales in June. Commonly used for date conditions: WHERE SaleDate BETWEEN „6/1/2012‟ AND „6/30/2012‟
  • 26. Standard Aggregation Functions SUM total value of items AVG average of values MIN minimum value MAX maximum value COUNT number of rows STDEV standard deviation VAR variance of items
  • 27. Sample Data: Sales Amount Amount $197.54 $526.76 $353.76 $153.00 $863.39 $255.93
  • 28. Query: Aggregation Count Avg Sum 6 $391.73 $2,350.38
  • 29. Aggregation Query in Access Grid Click Totals Button Totals Row
  • 30. Row-by-Row Computations Type formula Then change row heading Category Price EstCost Electronics $1,000.00 700 Electronics $50.00 35
  • 31. SQL: Aggregation How many customers are there and want is the average balance? SELECT Count(CustomerID) AS NCustomers, Avg(AccountBalance) AS AverageOwed FROM Customers
  • 32. SQL: Row-by-Row Calculations Estimate the cost of clothing items as 70 percent of the price. SELECT Category, Price, 0.7*Price AS EstCost FROM Items WHERE (Category=”Electronics”)
  • 33. Subtotals: SQL How much money is owed by customers in each city? SELECT City, Sum(AccountBalance) AS SumOfAccountBalance FROM Customers GROUP BY City City SumOfAccountBalance Chicago $197.54 Denver $1,016.39 Miami $255.93 Phoenix $526.76 Seattle $353.76
  • 34. Multiple Tables Customers Sales CID LastName Phone City AccountBalance SaleID CID SPID SaleDate 12345 Jones 312-555-1234 Chicago $197.54 117 12345 887 3/3/2012 28764 Adamz 602-999-2539 Phoenix $526.76 125 87535 663 4/4/2012 29587 Smitz 206-656-7763 Seattle $353.76 157 12345 554 4/9/2012 33352 Sanchez 303-444-1352 Denver $153.00 169 29587 255 5/5/2012 44453 Kolke 303-888-8876 Denver $863.39 178 44453 663 5/1/2012 87535 James 305-777-2235 Miami $255.98 188 29587 554 5/8/2012 201 12345 887 5/28/2012 211 44453 255 6/9/2012 Salespeople 213 44453 255 6/10/2012 215 87535 887 6/9/2012 SPID LastName DateHired Phone Commission 280 28764 663 5/27/2012 255 West 5/23/05 213-333-2345 5 285 28764 887 6/15/2012 452 Thomas 8/15/04 213-343-5553 3 554 Jabbar 7/15/01 213-534-8876 4 663 Bird 9/12/03 213-225-3335 4 ItemsSold 887 Johnson 2/2/02 213-887-6635 4 SaleID ItemID Quantity 117 1154 2 Items 117 3342 1 ItemID Category Description Price 117 7653 4 1154 Shoes Red Boots $100.00 125 1154 4 2254 Clothes Blue Jeans $12.00 125 8763 3 3342 Electronics LCD-40 inch $1,000.00 157 7653 2 7653 Shoes Blue Suede $50.00 169 3342 1 8763 Clothes Mens‟ Work Boots $45.00 169 9987 5 9987 Electronics Blu-Ray Player $400.00 178 2254 1
  • 35. Linking Tables The Sales to ItemsSold relationship enforces referential integrity. One Sale can list many ItemsSold.
  • 36. Query Example Which customers (CustomerID) have placed orders since June 1, 2012? SQL QBE SELECT CustomerID, SaleDate FROM Sales WHERE SaleDate >= #6/1/2012# ; Results CustomerID SaleDate 44453 6/9/2012 44453 6/10/2012 87535 6/9/2012 28764 6/15/2012
  • 37. Query Example What are the names of the customers who placed orders since June 1, 2012? SQL SELECT DISTINCT Customers.CustomerID, Name, SaleDate FROM Sales INNER JOIN Customers ON Sales.CustomerID = Customers.CustomerID WHERE SaleDate >= #6/1/2012# ; Grid Results CustomerID Name OrderDate 28764 Adamz 6/15/2012 44453 Kolke 6/9/2012 44453 Kolke 6/10/2012 87535 James 6/9/2012
  • 38. Query Example List the salespeople (sorted alphabetically) along with the names of customers who placed orders with that salesperson. SQL SELECT DISTINCT Salespeople.Name, Customers.Name FROM Salespeople INNER JOIN (Customers INNER JOIN Orders ON Customers.CustomerID=Sales.CustomerID) ON Salespeople.SalespersonID = Sales.SalespersonID ORDER BY Salespeople.Name, Customers.Name ; Results SalesName Cust.Name QBE Bird Adamz Bird James Bird Kolke Jabbar Jones Jabbar Smitz Johnson Adamz Johnson James Johnson Jones West Kolke West Smitz
  • 39. Multiple Tables, GROUP BY, WHERE Who are the top salespeople in June? Begin by listing the sales in June.
  • 40. Sales Rows SalespersonI Name SaleDat Quantity Price Value D e 255 West 6/9/201 2 $1,000.0 $2,000.0 2 0 0 255 West 6/9/201 5 $50.00 $250.00 2 255 West 6/9/201 1 $12.00 $12.00 2 887 Johnso 6/9/201 1 The quantity and price columns are shown$12.00 $12.00 temporarily to ensure the computation is specified n 2 correctly for the Value column. 887 Johnso 6/9/201 1 $50.00 $50.00 n 2
  • 41. Subtotal in SQL SELECT Salespeople.SalespersonID, Salespeople.Name, Sum([Quantity]*[Price]) AS [Value] FROM Items INNER JOIN ((Salespeople INNER JOIN Sales ON Salespeople.SalespersonID = Sales.SalespersonID) INNER JOIN ItemsSold ON Sales.SalesID = ItemsSold.SaleID) ON Items.ItemID = ItemsSold.ItemID WHERE (Sales.SaleDate Between #6/1/2012# And #6/30/2012#) GROUP BY Salespeople.SalespersonID, Salespeople.Name ORDER BY Sum([Quantity]*[Price]) DESC;
  • 42. Subtotals: Access Grid First Attempt Who are the top salespeople in June? Set the totals and set the Sum column. Incomplete. See results…
  • 43. Initial Results SalespersonID Name SaleDate Value 255 West 6/9/2012 $2,250.00 255 West 6/10/2012 $12.00 887 Johnson 6/9/2012 $62.00 Salesperson #255 (West) shows up multiple times because of multiple days. GROUP BY Day, Salesperson
  • 44. GROUP BY Conditions: WHERE Use WHERE instead of GROUP BY
  • 45. Best Salesperson Results SalespersonID Name Value 255 West $2,262.00 887 Johnson $62.00
  • 46. Converting Business Questions to Queries 1. What do you want to see? SELECT FROM 2. What constraints are you given? INNER JOIN 3. What tables are involved? WHERE GROUP BY 4. How are the tables joined? ORDER BY • Start with the parts you know how to do. • Verify the results at each step. • Add more tables and columns as needed • Do aggregate totals at the end—after verifying the rows. • Look for “for each” or “by” to use GROUP BY for subtotals.
  • 48. Notation Table Table name columns Customer (CustomerID, LastName, Phone, Street, City, AccountBalance) Last Account CustomerID Phone Street City Name Balance 12345 Jones (312) 555-1234 125 Elm Street Chicago $197.54 28764 Adamz (602) 999-2539 938 Main Street Phoenix $526.76 29587 Smitz (206) 676-7763 523 Oak Street Seattle $353.76 33352 Sanchez (303) 444-1352 999 Pine Street Denver $153.00 44453 Kolke (303) 888-8876 909 West Avenue Denver $863.39 87535 James (305) 777-2235 374 Main Street Miami $255.93
  • 49. 1st: Repeating SaleForm(SaleID, SaleDate, CustomerID, Phone, Name, Street, (ItemID, Quantity, Description, Price ) ) Repeating Section Causes duplication SaleID SaleDate CustomerID Name Phone Street ItemID Quantity Description Price 117 3/3/2012 12345 Jones (312) 555-1234 125 Elm Street 1154 2 Red Boots $100.00 117 3/3/2012 12345 Jones (312) 555-1234 125 Elm Street 3342 1 LCD-40 inch $1,000.00 117 3/3/2012 12345 Jones (312) 555-1234 125 Elm Street 7653 4 Blue Suede $50.00 125 4/4/2012 87535 James (305) 777-2235 374 Main Street 1154 4 Red Boots $100.00 125 4/4/2012 87535 James (305) 777-2235 374 Main Street 8763 3 Men's Work Boots $45.00 157 4/9/2012 12345 Jones (312) 555-1234 125 Elm Street 7653 2 Blue Suede $50.00 169 5/6/2012 29587 Smitz (206) 676-7763 523 Oak Street 3342 1 LCD-40 inch $1,000.00 169 5/6/2012 29587 Smitz (206) 676-7763 523 Oak Street 9987 2 Blu-Ray Player $400.00 178 5/1/2012 44453 Kolke (303) 888-8876 909 West Avenue 2254 1 Blue Jeans $12.00 188 5/8/2012 29587 Smitz (206) 676-7763 523 Oak Street 3342 1 LCD-40 inch $1,000.00 188 5/8/2012 29587 Smitz (206) 676-7763 523 Oak Street 8763 4 Men's Work Boots $45.00 201 5/23/2012 12345 Jones (312) 555-1234 125 Elm Street 1154 1 Red Boots $100.00
  • 50. First Normal SalesForm with repeating data SaleID SaleDate CustomerID Name Phone Street ItemID, Quantity, Description, Price 117 3/3/2012 12345 Jones (312) 555-1234 125 Elm Street 1154, 2, Red Boots, $100.00 3342, 1, LCD-40 inch, $1,000.00 7653, 4, Blue Suede, $50.00 125 4/4/2012 87535 James (305) 777-2235 374 Main Street 1154, 4, Red Boots, $100,00 8763, 3, Men‟s Work Boots, $45.00 157 4/9/2012 12345 Jones (312) 555-1234 125 Elm Street 7653, 2, Blue Suede, $50.00 169 5/6/2012 29587 Smitz (206) 676-7763 523 Oak Street 3342, 1, LCD-40 inch, $1,000.00 9987, 2, Blu-Ray Player, $400.00 178 5/1/2012 44453 Kolke (303) 888-8876 909 West Avenue 2254, 1, Blue Jeans, $12.00 188 5/8/2012 29587 Smitz (206) 676-7763 523 Oak Street 3342, 1, LCD-40 inch, $1,000.00 8763, 1, Men‟s Work Boots, $45.00 201 5/23/2012 12345 Jones (312) 555-1234 125 Elm Street 1154, 1, Red Boots, $100.00 Not in First Normal Form
  • 51. 1st: Split SaleForm(SaleID, SaleDate, CustomerID, Phone, Name, Street, (ItemID, Quantity, Description, Price ) ) SaleForm2(SaleID, SaleDate, CustomerID, Phone, Name, Street) SaleID SaleDate CustomerID Name Phone Street SaleLine(SaleID, ItemID, Quantity, Description, Price) 117 3/3/2012 12345 Jones (312) 555-1234 125 Elm Street 117 3/3/2012 12345 Jones (312) 555-1234 125 Elm Street SaleID ItemID Quantity Description Price 117 3/3/2012 12345 Jones (312) 555-1234 125 Elm Street 117 1154 2 Red Boots $100.00 125 4/4/2012 87535 James (305) 777-2235 374 Main Street 117 3342 1 LCD-40 inch $1,000.00 125 4/4/2012 87535 James (305) 777-2235 374 Main Street 117 7653 4 Blue Suede $50.00 125 1154 4 Red Boots $100.00 Note: replication 125 8763 3 Men's Work Boots $45.00 157 7653 2 Blue Suede $50.00 169 3342 1 LCD-40 inch $1,000.00 169 9987 2 Blu-Ray Player $400.00 178 2254 1 Blue Jeans $12.00 Note: replication 188 3342 1 LCD-40 inch $1,000.00 188 8763 4 Men's Work Boots $45.00 201 1154 1 Red Boots $100.00
  • 52. 2nd Split Column depends on entire (whole) key. SalelLine(SaleID, ItemID, Quantity, Description, Price) ItemsSold(SaleID, ItemID, Quantity ) Items(ItemID, Description, Price) SaleID ItemID Quantity ItemID Description Price 117 1154 2 1154 Red Boots $100.00 117 3342 1 2254 Blue Jeans $12.00 117 7653 4 3342 LCD-40 inch $1,000.00 125 1154 4 7653 Blue Suede $50.00 125 8763 3 8763 Men's Work Boots $45.00 157 7653 2 9987 Blu-Ray Player $400.00 169 3342 1 169 9987 2 178 2254 1 188 3342 1
  • 53. 3rd Split SaleForm2(SaleID, SaleDate, CustomerID, Phone, Name, Street) Sales(SaleID, SaleDate, CustomerID ) SaleID SaleDate CustomerID SalespersonID 117 3/3/2012 12345 887 125 4/4/2012 87535 663 157 4/9/2012 12345 554 169 5/6/2012 29587 255 178 5/1/2012 44453 663 188 5/8/2012 29587 554 Customers(CustomerID, Phone, Name, Address, City, State, ZipCode) CustomerID Name Phone Street City AccountBalance 12345 Jones (312) 555-1234 125 Elm Street Chicago $197.54 28764 Adamz (602) 999-2539 938 Main Street Phoenix $526.76 29587 Smitz (206) 676-7763 523 Oak Street Seattle $353.76 33352 Sanchez (303) 444-1352 999 Pine Street Denver $153.00 44453 Kolke (303) 888-8876 909 West Avenue Denver $863.39 87535 James (305) 777-2235 374 Main Street Miami $255.93
  • 55. DBMS Input Screen Text/Labels Data Variables Command Buttons Record Selectors Scrolling Region/Subform - Subform - Main
  • 56. DBMS Report Writer  Report header  Page header  Break/Group header  Detail  Footers
  • 58. Designing Menus for Users Main Menu Customer Information 1. Setup Choices Daily Sales Reports 2. Data Input Friday Sales Meeting 3. Print Reports Monthly Customer Letters 4. DOS Utilities 5. Backups Quit As a secretary, which menu is easier to understand?
  • 59. Database Administration  Database Administrator ◦ Testing ◦ Backup ◦ Recovery ◦ Standards ◦ Access Controls
  • 60. E-Business Databases  E-business is transaction-based  Databases support multiple users and protect transactions  Modern websites are driven by databases
  • 61. E-Business Databases SQL Results Database Server Web Server Web program script <HTML> Text Data </HTML> Order Form Descriptions Prices Customer
  • 62. Cloud Computing with Databases Google: BigTable, developed for internal storage AppEngine: http://code.google.com/appengine/ Best for complex documents/objects It is not SQL; no JOINs Three keys: Row, Column, Time/version Generic: Hadoop (Apache) Amazon: S3 Files, particularly large media files http://aws.amazon.com/s3/ SimpleDB Similar to BigTable http://aws.amazon.com/simpledb/ RDS Relational data service MySQL or Oracle 11g http://aws.amazon.com/rds/ Microsoft: Azure SQL Server http://www.microsoft.com/windowsazure/
  • 63. Cloud Database Service Benefits  No fixed costs ◦ No hardware or software ◦ No maintenance ◦ Easy administration  Pricing based on usage ◦ Monthly data storage (size) ◦ Monthly data transfer (usage)  Scalable ◦ Multiple, distributed servers ◦ Multiple, high-speed Internet connections  Reliable ◦ Distributed ◦ Run by experts ◦ Security monitoring
  • 64. Cloud Database Limits  Costs increase based on usage  At some point, it might be cheaper to buy and run everything yourself  Not pay profit/overhead to third-party  But be sure to measure all fixed costs
  • 65. Cloud Database Pricing Example: Amazon RDS (MySQL), U.S. East 1 Extra large instance 20 hours/day 20 GB/month at 50 million I/O per month 10 GB/month data transfer in All values are estimates and 500 GB/month data transfer out might not include all fees. 20 GB/month regional transfer => $616 per month ($7400/year) Example: Microsoft SQLAzure Business Edition 1 Extra large instance ($0.96/hour = $576/month) 20 GB/month ($200/month) 10 GB/month data transfer in ($1/month) 500 GB/month data transfer out ($75/month) => $852 per month ($10,224/year) You get a relatively large database with T1-level data transfer for less than 10 percent of the cost of a DBA.
  • 66. Technology Toolbox: Building Forms in Access 1. Start the Form Wizard 2. Select the SalesTable, all columns 3. Customer Table: Phone 4. ItemsSold, all columns except SaleID 5. Product Table, Category 6. Design View, rearrange, add Combo boxes
  • 67. Quick Quiz: Forms in Access 1. Create a simple customer form and enter data to test it. 2. Create a basic order form and add a combo box to select customers.
  • 68. Technology Toolbox: Creating Database Reports 1. Start the Report Wizard 2. Select the columns for the report: CustomerID, Name, Phone, SaleDate, Description, Price, Quantity 3. Choose a layout 4. Click Summary Options to sum Quantity 5. Use Design View to clean up the layout and format 6. Add a text box for Value: =Price*Quantity 7. Edit the Sums to use the same calculation
  • 69. Quick Quiz: Creating a Report 1. Create a report that prints all of the items ordered by each customer. 2. Create a report that prints each customer, followed by the orders for that customer. 3. Create a report that displays a chart of total sales by customer.
  • 70. Cases: Pharmaceuticals Annual Revenue 80 70 60 50 Pfizer Billion $ 40 GlaxoSmithKline 30 Bristol-Myers Squibb 20 Eli Lilly 10 0 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 Net Income / Revenue 0.6 0.5 0.4 0.3 Pfizer Ratio GlaxoSmithKline 0.2 Bristol-Myers Squibb 0.1 Eli Lilly 0 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 -0.1 -0.2

Notas del editor

  1. Database Management System (DBMS) is a set of programs that enables you to store, modify, and extract information from a database, it also provides users with tools to add, delete, access, modify, and analyze data stored in one location. A group can access the data by using query and reporting tools that are part of the DBMS or by using application programs specifically written to access the data. DBMS’s also provide the method for maintaining the integrity of stored data, running security and users access, and recovering information if the system fails. The information from a database can be presented in a variety of formats. Most DBMSs include a report writer program that enables you to output data in the form of a report. Many DBMSs also include a graphics component that enables you to output information in the form of graphs and charts. Database and database management system are essential to all areas of business, they must be carefully managed. There are many different types of DBMSs, ranging from small systems that run on personal computers to huge systems that run on mainframes. The following are examples of database applications: computerized library systems, flight reservation systems, and computerized parts inventory systems.
  2. SQL ( /ˈɛskjuː ˈɛl/ &quot;S-Q-L&quot;;[3] or &quot;sequel&quot;; or Structured Query Language) is a special-purpose programming language designed for managing data in relational database management systems (RDBMS).