Write an Alter Table statement That adds two new check constraints to the Invoic
ID: 3529966 • Letter: W
Question
Write an Alter Table statement That adds two new check constraints to the
Invoices table of the Ap database. The first should allow (1) PaymentDate to be
null only if PaymentTotal is zero and (2) PaymentDate to be not null only if
PaymentTotal is greater than zero. The second constraint should prevent the sum
of PaymentTotal and CreditTotal from being greater than InvoiceTotal.
Delete the GroupMembership Table From the Membership database. Then, write a
Create Table statement that recreates the table, this time with a unigue
constraint that prevents an individual from being a member in the same group
twice.
Explanation / Answer
ALTER TABLE Invoices WITH CHECK ADD check ( (PaymentTotal = 0 AND PaymentDate is NULL) OR (PaymentTotal > 0 AND PaymentDate is NOT NULL) ) ADD CHECK ( (PaymentTotalRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.