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

1. Write a select statement to display the total amount invoiced for each Accoun

ID: 3565293 • Letter: 1

Question

1. Write a select statement to display the total amount invoiced for each AccountNo using the WITH ROLLUP operator to include a row showing the grand total.

2. Display only the top 3 InvoiceID and InvoiceTotal from the Invoices table based on the InvoiceTotal. In other words, the 3 most expensive invoices only. Order the results in descending order by InvoiceTotal.

3. Modify

USE AP;

SELECT VendorName, InvoiceID
FROM Vendors v left outer join Invoices i
ON v.VendorId=i.VendorId
ORDER BY VendorName

show only those vendors that do not have an associated invoice

Explanation / Answer

1) SELECT AccountNo,[AmountInvoiced]
SUM ([AmountInvoiced]) AS [AmountInvoiced]
FROM tblAccount
GROUP BY AccountNo,[AmountInvoiced] WITH ROLLUP

2)

SELECT InvoiceID,InvoiceTotal FROM Invoicetable ORDER BY InvoiceTotal DESC LIMIT 0,3

3) Your third question is not clear. Let me know the completed details of variable and I'll modify the answer