/****************************************************************************************/
/*                                                                                      */
/*  Kroenke, Auer, Vandenberg, and Yoder - Database Concepts (8th Edition) Chapter 08   */
/*                                                                                      */
/*  Heather Sweeney Designs Data Warehouse Database Insert Data                         */
/*                                                                                      */
/*  HSD-DW SALES_FOR-RFM Data                                                           */
/*                                                                                      */
/*  PRIMARY KEY = (TimeID, CustomerID, InvoiceNumber)                                   */
/*                                                                                      */
/*  These are the Oracle Database XE SQL code solutions                          */
/*                                                                                      */
/****************************************************************************************/
 
/*
To fill in the SALES_FOR_RFM table:
TimeID: For each invoice (HSD data from Chapter 3) use the InvoiceDate to lookup the TimeID in the TIMELINE table.
CustomerID: For each Invoice use CustomerID.
InvoiceNumber: For each invoice use InvoiceNumber.
PreTaxTotalSales:  For each Invoice we add up the Totals from the associated LINE_ITEM table (HSD data from Chapter 3) and insert that sum.
*/
 
 
INSERT INTO SALES_FOR_RFM VALUES(42658, 3, 35000, 22.94);
 
INSERT INTO SALES_FOR_RFM VALUES(42668, 4, 35001, 47.89);
 
INSERT INTO SALES_FOR_RFM VALUES(42724, 7, 35002, 24.95);
 
INSERT INTO SALES_FOR_RFM VALUES(42819, 4, 35003, 64.85);
 
INSERT INTO SALES_FOR_RFM VALUES(42821, 6, 35004, 94.79);
 
INSERT INTO SALES_FOR_RFM VALUES(42821, 7, 35005, 94.80);
 
INSERT INTO SALES_FOR_RFM VALUES(42825, 9, 35006, 47.89);
     
INSERT INTO SALES_FOR_RFM VALUES(42828, 11, 35007, 109.78);
 
INSERT INTO SALES_FOR_RFM VALUES(42833, 5, 35008, 47.89);
 
INSERT INTO SALES_FOR_RFM VALUES(42833, 1, 35009, 47.89);
 
INSERT INTO SALES_FOR_RFM VALUES(42848, 3, 35010, 24.95);
     
INSERT INTO SALES_FOR_RFM VALUES(42862, 9, 35011, 22.94);
     
INSERT INTO SALES_FOR_RFM VALUES(42876, 8, 35012, 54.89);
 
INSERT INTO SALES_FOR_RFM VALUES(42891, 3, 35013, 47.89);
 
INSERT INTO SALES_FOR_RFM VALUES(42891, 11, 35014, 45.88);
 
INSERT INTO SALES_FOR_RFM VALUES(42891, 12, 35015, 94.79);
 
INSERT INTO SALES_FOR_RFM VALUES(42891, 3, 35016, 45.88);
 
/*********************************************************************************/