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

microsoft SQL Server Management Studio Write a SELECT statement that returns one

ID: 3535631 • Letter: M

Question

microsoft SQL Server Management Studio


Write a SELECT statement that returns one row for each customer that has orders with these columns: The Email Address column from the Customers table A count of the number of orders The total amount for each order (Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.) Return only those row's where the customer has more than than 1 order. Sort the result set in descending sequence by the sum of the line item amounts. Write a SELECT statement that answers this question: Which customers have ordered more than one product? Return these columns: The email address from the Customers table The count of distinct products from the customers orders

Explanation / Answer

SELECT DISTINT EMAILADDRESS,NO_OF_ORDERS, ((PRICE-DISCOUNT)*QUANTITY) AS TOTAL_AMOUNT WHERE NO_OF_ORDER>1 ORDER BY TOTAL_AMOUNT



3) SELECT EMAILADDRESS,COUNT(PRODUCTS) FROM CUSTOMERS_TABLE JOIN ON CUSTOMERS_ORDERS WHERE CUSTOMERS_TABLE.CUSTOMER_NO=CUSTOMERS_ORDER