This is in SQL 5. Write an UPDATE statement that modifies the InvoiceCopy table.
ID: 3710428 • Letter: T
Question
This is in SQL
5. Write an UPDATE statement that modifies the InvoiceCopy table. Change the PaymentDate to today’s date and the PaymentTotal to the balance due for each invoice with a balance due. Set today’s date with the GETDATE() function.Show the query and the number of affected rows in the assignment submission.
6. Write an UPDATE statement that modifies the InvoiceCopy table. Change TermsID to 2 for each invoice that’s from a vendor with a DefaultTermsID of 2. Use a JOIN clause. Show the query and the number of affected rows in the assignment submission.
Explanation / Answer
5)
UPDATE InvoiceCopy
SET PaymentDate = GETDATE(),
PaymentTotal = InvoiceTotal - CreditTotal
WHERE InvoiceTotal - CreditTotal - PaymentTotal > 0;
6)
UPDATE InvoiceCopy
SET TermsID = 2
FROM InvoiceCopy JOIN VendorCopy
ON InvoiceCopy.VendorID = VendorCopy.VendorID
WHERE DefaultTermsID = 2;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.