SQL I need help with the following question. Thank you Consider the table struct
ID: 3705836 • Letter: S
Question
SQL
I need help with the following question. Thank you
Consider the table structure shown INVOICES Columns Data Constraints Grants Statistics ITriggers |Flashback IDependencies IDetails Partitions Indexes SQL ? Actions. COMMENTS 1 (null) 2 (nul) 3 (null) 4 (null) 5 (null) 6 (null) 7 (null) 8 (null) 9 (null) 10 (null) COLUMN ID COLUMN NAME 1 INVOICEID 2 VENDOR ID 3 INVOICE_NUMBER VARCHAR2(50 BYTE) No 4 INVOICE DATE DATA TYPE NUMBER NUMBER NULLABLE DATA DEFAULT No No No No Yes Yes No No Yes (null) (null) (null) (null) (null) 0 0 (null) (null) (null) DATE 5 INVOICE_TOTALNUMBER(9,2) 6 PAYMENT_TOTAL NUMBER(9,2) NUMBER(9,2) 7 CREDIT TOTAL 8 TERMS ID 9 INVOICE DUE DATE DATE 10 PAYMENT DATE DATE NUMBER Write a command to add a constraint to this table so that the combination of vendor id and invoice number is uniqueExplanation / Answer
Answer: Create a new constraint with both vendor_id and invoice_number
ALTER TABLE INVOICES ADD CONSTRAINT uq_invoice UNIQUE(VENDOR_ID, INVOICE_NUMBER);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.