Adding 2006 Data

In Chapter 14, “Snapshots” you populated the month_end_sales_order_fact table with February 2006 data. You now need to add more data (January 2006 data and March 2006 through December 2006 data) by running the month_end_sales_order.sql script from Chapter 14. You must run the script once a month. Don’t forget to set your MySQL date to the month end date right before each run. All runs look exactly the same on the MySQL monitor. Here’s an example.

mysql> . c:mysqlscriptsmonth_end_sales_order.sql

Database changed
Query OK, 1 row affected (0.09 sec)
Records: 1  Duplicates: 0  Warnings: 0

When you finish loading additional data (eleven times altogether), use the following SQL statement to query the month_end_sales_order_fact table to make sure it has been populated correctly.

mysql> select month, year, product_name,
    -> month_order_amount mo_amt, month_order_quantity mo_qty
    -> from  month_end_sales_order_fact a, month_dim b, product_dim
       c
    -> where a.month_order_sk = b.month_sk
    -> and a.product_sk = c.product_sk
    -> and year = 2006
    -> order BY month, year, product_name;

Here is the query result.

+-------+------+--------------------------+----------+--------+
| month | year | product_name             | mo_amt   | mo_qty |
+-------+------+--------------------------+----------+--------+
|     1 | 2006 | LCD Panel                |  1000.00 |   NULL |
|     2 | 2006 | Hard Disk Drive          |  1000.00 |   NULL |
|     4 | 2006 | LCD Panel                |  2500.00 |   NULL |
|     5 | 2006 | Hard Disk Drive          |  3000.00 |   NULL |
|     6 | 2006 | Floppy Drive             |  3500.00 |   NULL |
|     7 | 2006 | LCD Panel                |  4000.00 |   NULL |
|     8 | 2006 | Hard Disk Drive          |  4500.00 |   NULL |
|     9 | 2006 | Floppy Drive             |  1000.00 |   NULL |
|    10 | 2006 | LCD Panel                |  1000.00 |   NULL |
+-------+------+--------------------------+----------+--------+
10 rows in set (0.09 sec)

Note that there is no data for November and December.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.70.247