Question: Preliminary work for this Project 1 . Use the CREATE and SELECT SQL statements to Create a Temporary table as a full copy ( all

Preliminary work for this Project
1. Use the CREATE and SELECT SQL statements to Create a Temporary table as a full copy (all rows & columns) of the table ORDERS. Name the new table ORDERS_COPY.
2. Display the content of the new table.
3. Write a SQL statement to convert the column ORDER_MODE of your ORDERS_COPY table into Capital letters (use the built-in function UPPER).
4. Write a SQL statement to check, by COUNTing, if there are NULLs in the SALES_REP_ID column of the table ORDERS_COPY.
5. Display the rows having null values in the SALES_REP_ID column.
6. Write a SQL statement to replace all NULLs in the column SALES_REP_ID of the table ORDERS_COPY with 999(as an ID for a vitual Sales Representative).
7. Display the content of the table ORDERS_COPY.
8. Run the statement SELECT COUNT(PROMOTION_ID) FROM ORDERS_COPY; Note that you get 0 althought there are 105 rows with NULL in the column PROMOTION_ID.
9. Explain why you get zero.
10. Write a SQL statement to replace all nulls in the PROMOTION_ID column of the table ORDERS_COPY with 0(zero).
11. Re-run the statement SELECT COUNT(PROMOTION_ID) FROM ORDERS_COPY; Explain why this result value.
You need table ORDERS_COPY to complete your Project 3.
Project Tasks.
You want to load a Star Schema as shown above. To do this you must use the tables that you have prepared in previous project - T_DATE, CUSTOMERS_COPY, and ORDERS_COPY.
1. The OE database does not have a SALESMAN table, we need to CREATE one called T_SALESMAN (SALES_REP_ID, SNAME) from the OE.ORDERS.SALES_REP_ID; its columns are:
SALES_REP_ID unique values. Replace Null IDs with 999; it is better than ignore Nulls in analysis. Do not define a PK because the table has too few rows.
SNAME is a new column. Unfortunately, we do not have the names of the sales representatives in the OE database. To overcome this problem and facilitate filling the new table, set the SNAME as the concatenation of the SALES_REP_ID and the constant NAME(for example, Salesman 153 will have name NAME-153....); note this tip is just for the lab work but does not apply is real situations.
You should get the following content for T_SALESMAN check attachment. CCDS-221 Data Warehouse
SALESREPIDSNAME153NAME-153154NAME-154155NAME-155156NAME-156158NAME-158159NAME-159160NAME-160161NAME-161163NAME-163999NAME-999
2. Create Dimensions
Use the CREATE with an embedded SELECT statement (and tables T_DATE, CUSTOMERS_COPY, ORDERS_COPY, and T_SALESMAN) to create and load the four dimensional tables D_ORDERS, D_CUSTOMERS, D_TIME and D_SALESMAN as they are described in the figure shows in the attachment.
For each Dimension, define the PK constraint and name it as follows:
PK_D_ORDERS Primary Kay for D_ORDERS
PK_D_SALESMAN Primary Kay for D_SALESMAN
PK_D_TIME Primary Kay for D_TIME
PK_D_CUSTOMERS Primary Kay for D_CUSTOMERS
3. Create Fact Table
CREATE the fact table F_ORDERS (F_ORDERS_ID, ORDER_AMOUNT,...Complete with the other columns....).
4. 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.
5. 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, .....)
6. Create an Oracle Sequence SEQ_F_ORDERS starting with 1.(You will use this sequence to populate F_ORDERS_ID primary key).
7. 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.
8. Display the SUM of the column ORDER_AMOUNT from the fact F_ORDERS.
9. Display the Turnover (sum of ORDER_AMOUNT) by Customer (ID_C, C_FName) and by Year.
10. COUNT the number of ORDERS having an amount greater that a given value (choose a value).
11. Display the percentage of amount of DIRECT Orders and ONLINE Orders.
Preliminary work for this Project 1 . Use the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!