Question: help me to this steps with SQL language code of tables in prevoius lab: create table T_SALESMAN (SALES_REP_ID, SNAME) as select nvl(SALES_REP_ID,999) , 'Name-' ||SALES_REP_ID


Tables to use In the previous Lab you have created the tables D_ORDERS, D_CUSTOMERS, D_TIME, and D_SALESMAN. To complete the loading of the Star schema depicted in Figure 8.1, you will need these dimension tables and the table ORDERS_COPY. Year SName ID_S D_SALESMAN Month-Name Quarter Month No Date IDT D_TIME OMode ORDERS D_ORDERS ID 0 Status ORDER AMOUNT FName ID SLName D_CUSTOMERS Gender Type Figure 8.2. A Simplified Star Schema Questions to Answer 1. CREATE the fact table F_ORDERS (FORDERS ID ORDER_AMOUNT....Complete with the other columns....). CCDS-221 Data Warehouse 2. The PK of the fact table F_ORDERS could be either the concatenation of all FKs referencing the dimensions linked to the fact, or the UNIQUE column F_ORDERS_ID. Define a PK constraint called PK_F_ORDERS_ID on the column F_ORDERS_ID. 3. The fact table F_ORDERS references the four dimensions D_TIME, D_CUSTOMERS, D_ORDERS and D_SALESMAN. Define all its Foreign keys (Follow the naming convention: FK_ORDERS_TO_DATE, 4. Create an Oracle Sequence SEQ_F_ORDERS starting with 1. (You will use this sequence to populate FORDERS ID primary key). 5. Develop SQL statement(s) to load F_ORDERS. Note that the measure ORDER_AMOUNT is in EURO and you extract it from the table ORDERS_COPY. 6. Display the SUM of the column ORDER_AMOUNT from the fact F_ORDERS. 7. Display the Turnover (sum of ORDER_AMOUNT) by Customer (ID_C, C_FName) and by Year. 8. COUNT the number of ORDERS having an amount greater that a given value (choose a value). 9. Display the percentage of amount of DIRECT Orders and ONLINE Orders. Measures Granularity. Suppose that we need to implement another star schema by removing the D_SALESMAN dimension from Figure 8.1. In this case, the granularity of the ORDER_AMOUNT measure changes since it functionally depends on 3 identifiers of dimensions instead of 4. 10. Referring to the content of the fact F_ORDERS, how many rows will be in the new fact? 11. Develop a SELECT statement that calculates and displays the rows of the new fact. T_SALESMAN SName Year Quarter Month-Name Month-No Date IDT D_TIME ID_ D_SALESMAN ORDERS_COPY OMode T_DATE FORDERS D_ORDERS ORDER_AMOUNT Status C FName ID C C LName D_CUSTOMERS CUSTOMER_COPY Gender o Type Tables to use In the previous Lab you have created the tables D_ORDERS, D_CUSTOMERS, D_TIME, and D_SALESMAN. To complete the loading of the Star schema depicted in Figure 8.1, you will need these dimension tables and the table ORDERS_COPY. Year SName ID_S D_SALESMAN Month-Name Quarter Month No Date IDT D_TIME OMode ORDERS D_ORDERS ID 0 Status ORDER AMOUNT FName ID SLName D_CUSTOMERS Gender Type Figure 8.2. A Simplified Star Schema Questions to Answer 1. CREATE the fact table F_ORDERS (FORDERS ID ORDER_AMOUNT....Complete with the other columns....). CCDS-221 Data Warehouse 2. The PK of the fact table F_ORDERS could be either the concatenation of all FKs referencing the dimensions linked to the fact, or the UNIQUE column F_ORDERS_ID. Define a PK constraint called PK_F_ORDERS_ID on the column F_ORDERS_ID. 3. The fact table F_ORDERS references the four dimensions D_TIME, D_CUSTOMERS, D_ORDERS and D_SALESMAN. Define all its Foreign keys (Follow the naming convention: FK_ORDERS_TO_DATE, 4. Create an Oracle Sequence SEQ_F_ORDERS starting with 1. (You will use this sequence to populate FORDERS ID primary key). 5. Develop SQL statement(s) to load F_ORDERS. Note that the measure ORDER_AMOUNT is in EURO and you extract it from the table ORDERS_COPY. 6. Display the SUM of the column ORDER_AMOUNT from the fact F_ORDERS. 7. Display the Turnover (sum of ORDER_AMOUNT) by Customer (ID_C, C_FName) and by Year. 8. COUNT the number of ORDERS having an amount greater that a given value (choose a value). 9. Display the percentage of amount of DIRECT Orders and ONLINE Orders. Measures Granularity. Suppose that we need to implement another star schema by removing the D_SALESMAN dimension from Figure 8.1. In this case, the granularity of the ORDER_AMOUNT measure changes since it functionally depends on 3 identifiers of dimensions instead of 4. 10. Referring to the content of the fact F_ORDERS, how many rows will be in the new fact? 11. Develop a SELECT statement that calculates and displays the rows of the new fact. T_SALESMAN SName Year Quarter Month-Name Month-No Date IDT D_TIME ID_ D_SALESMAN ORDERS_COPY OMode T_DATE FORDERS D_ORDERS ORDER_AMOUNT Status C FName ID C C LName D_CUSTOMERS CUSTOMER_COPY Gender o Type
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
