Write a SELECT statement that returns four columns; VendorName From the Vendors
ID: 440201 • Letter: W
Question
Write a SELECT statement that returns four columns; VendorName From the Vendors table InvoiceNumber From the Invoices table InvoiceDate From the Invoices table Balance InvoiceTotal minus the sum of PaymentTotal and CreditTotal The result set should have one row for each invoice with a non-zero balance. Sort the result set by VendorName in ascending order. (Use the IMPLICIT join syntax)Explanation / Answer
1. SELECT distinct VendorName FROM Vendors WHERE VendorID IN ( SELECT VendorID FROM Invoices ) 2 SELECT InvoiceID, InvoiceTotal FROM INVOICES WHERE PaymentTotaL> (SELECT Avg(PaymentTotal) FROM INVOICES) 4 Select AccountNo, AccountDescription From GLAccounts GLA where NOT EXISTS (select 1 from InvoiceLineItems I where I.AccountNo=GLA.AccountNo) order by AccountNo 5 SELECT VendorName, L.InvoiceID, InvoiceSequence, InvoiceLineItemAmount FROM InvoiceLineItems L JOIN Invoices I ON L.InvoiceID = I.InvoiceID JOIN Vendors V ON I.VendorID = V.VendorID WHERE L.InvoiceID IN (SELECT InvoiceID FROM InvoiceLineItems WHERE InvoiceSequence > 1)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.