Question: PLEASE HELP SOLVE Q10-15 IN SQL LIVE Standardizing an Amount of money by Conversion to Standard Currency Suppose the column ORDERS.ORDER_TOTAL is the amount of

PLEASE HELP SOLVE Q10-15 IN SQL LIVE
Standardizing an Amount of money by Conversion to Standard Currency Suppose the column ORDERS.ORDER_TOTAL is the amount of the order expressed in the currency of the country (NLS TERRITORY) of the Customer; i.e., when the CUSTOMER.NLS_TERRITORY is: CHINA the amount is in CHY, INDIA the amount is in INR, GERMANY and ITALY the amount is in EUR (Euro), ... In fact, there are eight (8) different countries in the CUSTOMERS.NLS_TERRITORY column (you can display). Before summing the amounts (of the column ORDERS.ORDER_TOTAL) we need to convert them to the same currency. Let us convert to Euro for example. For this purpose, we prepare the following table of change rates of currencies to Euro: CUR_SIGN CNY CURRENCY RATES TABLE COUNTRY CUR_QTY EURO_RATE CHINA 1 0.13 INDA 1 0.011 SWITZERLAN 1 0.92 INR CHF 3 Page THB CCDS-221 Data Warehouse THAILAND 1 JAPAN 1 ITALY 1 0.027 0.0079 JPY EUR 1 1 USD EUR AMERICA GERMANY 0.81 1 1 11. Execute the script BuildCurrency_Rates.sql to create the CURRENCY_RATES table and insert the 8 lines above. 12. Use the CREATE and SELECT statements to create, from the tables ORDERS and CUSTOMERS, a new table called ORDERS_IN_EURO (ORDER_ID, CUSTOMER_ID, COUNTRY, ORDER_TOTAL, ORDER_TOTAL_EURO). Note the COUNTRY is the value of NLS_TERRITORY column in the CUSTOMERS table. You should get 105 rows. 13. Write a PL/SQL function to populate the column ORDER_TOTAL_EURO that will contain the total of the order converted to EURO. 14. Check the content of some rows in the ORDER_TOTAL_EURO is correct. 15. Save your session as Lab5.sql, download and clean the script (i.e., keep valid statements only) for prospective use. Standardizing an Amount of money by Conversion to Standard Currency Suppose the column ORDERS.ORDER_TOTAL is the amount of the order expressed in the currency of the country (NLS TERRITORY) of the Customer; i.e., when the CUSTOMER.NLS_TERRITORY is: CHINA the amount is in CHY, INDIA the amount is in INR, GERMANY and ITALY the amount is in EUR (Euro), ... In fact, there are eight (8) different countries in the CUSTOMERS.NLS_TERRITORY column (you can display). Before summing the amounts (of the column ORDERS.ORDER_TOTAL) we need to convert them to the same currency. Let us convert to Euro for example. For this purpose, we prepare the following table of change rates of currencies to Euro: CUR_SIGN CNY CURRENCY RATES TABLE COUNTRY CUR_QTY EURO_RATE CHINA 1 0.13 INDA 1 0.011 SWITZERLAN 1 0.92 INR CHF 3 Page THB CCDS-221 Data Warehouse THAILAND 1 JAPAN 1 ITALY 1 0.027 0.0079 JPY EUR 1 1 USD EUR AMERICA GERMANY 0.81 1 1 11. Execute the script BuildCurrency_Rates.sql to create the CURRENCY_RATES table and insert the 8 lines above. 12. Use the CREATE and SELECT statements to create, from the tables ORDERS and CUSTOMERS, a new table called ORDERS_IN_EURO (ORDER_ID, CUSTOMER_ID, COUNTRY, ORDER_TOTAL, ORDER_TOTAL_EURO). Note the COUNTRY is the value of NLS_TERRITORY column in the CUSTOMERS table. You should get 105 rows. 13. Write a PL/SQL function to populate the column ORDER_TOTAL_EURO that will contain the total of the order converted to EURO. 14. Check the content of some rows in the ORDER_TOTAL_EURO is correct. 15. Save your session as Lab5.sql, download and clean the script (i.e., keep valid statements only) for prospective use
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
