Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Chapter 9 How to use functions Exercises \"DUE THIS WEEKE!!!! I NEED HELP!!! 1.

ID: 3765601 • Letter: C

Question

Chapter 9 How to use functions Exercises "DUE THIS WEEKE!!!! I NEED HELP!!!

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’s stored in the OrderDate column A column that returns only the day of the month that’s stored in the OrderDate column. A column that returns the result from adding thirty days to the OrderDate column.

3. Write a SELECT statement that returns these columns from the Orders table: The CardNumber column The length of the CardNumber column The last four digits of the CardNumber column When you get that working right, add the column that follows to the result set. This is more difficult because the column requires the use of functions within functions. A column that displays the last four digits of the CardNumber column in this format: XXXX-XXXX-XXXX-1234. In other words, use Xs for the first 12 digits of the card number and actual numbers for the last four digits of the number.

4. Write a SELECT statement that returns these columns from the Orders table: The OrderID column The OrderDate column A column named ApproxShipDate that’s calculated by adding 2 days to the OrderDate column The ShipDate column A column named DaysToShip that shows the number of days between the order date and the ship date When you have this working, add a WHERE clause that retrieves just the orders for March 2012.

Explanation / Answer

1. select Listprice, discountpercent, round((listprice*discountpercent/100),2) as discountamount from products;

2. select orderdate, year(orderdate), day(orderdate), orderdate+30 from orders;

3. select cardnumber, length(carnumber), rightformat('XXXX-XXXX-XXXX-'(cardnumber,4)) from order;

4. select orderid, orderdate, (orderdate+2) approxshipdate, shipdate, (shipdate-orderdate) daystoship where orderdate = 'March 2012';

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote