Can someone help me figure out these to questions, really would appreciate it. 1
ID: 3553079 • Letter: C
Question
Can someone help me figure out these to questions, really would appreciate it.
1. Write a SELECT statement that returns these columns from the Products table:
The ListPrice column
The DiscountPercent column
A column named DiscountAmount that uses the previous two columns to calculate the discount
amount and uses the ROUND function to round the result to 2 decimal places
2. Write a SELECT statement that returns these columns from the Orders table:
The OrderDate column
A column that returns the four-digit year thats stored in the OrderDate column
A column that returns only the day of the month thats stored in the OrderDate column.
A column that returns the result from adding thirty days to the OrderDate column.
Explanation / Answer
1)
Select ListPrice, DiscountPercent,
ROUND((ListPrice * DiscountPercent/100),2) AS DiscountAmount
from Products;
2)
Select OrderDate, TO_CHAR(OrderDate,'YYYY') AS OrderYear,
TO_CHAR(OrderDate,'DD') AS OrderDayOfMonth, --returns the date of month
TO_CHAR(OrderDate,'day') AS OrderDayOfWeek, -- returns the weekday, if u need keep it else delete this line
TO_CHAR(OrderDate+30) AS "30 Days After OrderDate"
from Orders;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.