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

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;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote