Answered step by step
Verified Expert Solution
Question
1 Approved Answer
answer Q3,4,5 1) Use the CREATE and SELECT statements to create one-column temporary table called T_ORDER_DATE (ORDER_DATE DATE) by copying the ORDER_DATE values from the
answer Q3,4,5
1) Use the CREATE and SELECT statements to create one-column temporary table called T_ORDER_DATE (ORDER_DATE DATE) by copying the ORDER_DATE values from the ORDERS table. (2 marks) 2) The T ORDER_DATE table may contain duplicates. To check the existence of duplicates, display the number of occurrences of each ORDER_DATE value. ( 2 marks) 3) A better way to answer the previous question is by creating T_ORDER_DATE with distinct values of dates. Write a SQL statement to empty the T_ORDER_DATE table. (2 marks) 4) Populate T_ORDER_DATE with distinct values of dates from ORDERS. (2 marks) 5) Assume the following temporary table T_DATE is already created: \[ \begin{array}{l} \text { T_DATE ( ORDER_DATE DATE, } \\ \text { Day_N NUMBER (1). } \\ \text { Day_Name CHAR(10), } \\ \text { Month_NO NUMBER (2), } \\ \text { Month_Name CHAR(10), } \\ \text { Quarter NUMBRR(1), } \\ \text { YYear NUMBER(4)) } \\ \end{array} \] Populate the T_DATE table from T_ORDER_DATE (use the built-in function TO_CHAR in the appendix for extracting the Date elements, and TO_NUMBER to convert into NUMBER). ( 2 marks) Note. All extracted values for CHAR fields (Day_Name and Month_Name) must be obtained in CAPITAL letters to avoid converting them later Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started