I have already gotten quite a bit of this done, but the professor is unresponsiv
ID: 3553153 • Letter: I
Question
I have already gotten quite a bit of this done, but the professor is unresponsive and there are no solutions online or in the book to compare work to.
Could someone please help? Please provide in the proper format so I can really compare apples to apples!
Chapter 9
How to use functions
Exercises
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 that
Explanation / Answer
// Pls let me know if you face any issues.
1. select ListPrice, DiscountedPercent, ROUND((ListPrice*DiscountedPrecent),2) as DiscountAmount from Products;
2. select year(OrderDate) as YYYY, DATEPART(D, OrderDate) as DAYOFMONTH, DATEADD(day,30,OrderDate) from Orders ;
3. select CardNumber, LEN(CardNumber) as LENGTH, RIGHT(CardNumber,4) as LastFourChaacter from Orders;
4. select OrderId, OrderDate, DATEADD(day,2, OrderDate) as ApproxShipDate, ShipDate, DATEDIFF(day, OrderDate,DATEADD(day,2, OrderDate)) as DaysToShip from Orders;
with the where clause
select OrderId, OrderDate, DATEADD(day,2, OrderDate) as ApproxShipDate, ShipDate, DATEDIFF(day, OrderDate,DATEADD(day,2, OrderDate)) as DaysToShip from Orders where MONHT(OrderDate)=3 and YEAR(OrderDate)=2012;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.