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

SELECT vendor_name, COUNT(*) AS number_of_invoices, MAX(invoice_total - payment_

ID: 3656451 • Letter: S

Question

SELECT vendor_name, COUNT(*) AS number_of_invoices, MAX(invoice_total - payment_total - credit_total) AS balance_due FROM vendors v JOIN invoices i ON v.vendor_id = i.vendor_id WHERE invoice_total - payment_total - credit_total > (SELECT AVG(invoice_total - payment_total - credit_total) FROM invoices) GROUP BY vendor_name ORDER BY balance_due DESC (Please refer to the code example above.) When this query is executed, the rows will be sorted by Answer a. balance_due in descending sequence b. invoice_id c. vendor_id

Explanation / Answer

b. invoice_id