How should you complete the statements?

Posted by: Pdfprep Category: 70-762 Tags: , ,

HOTSPOT

You have tables with the following requirements:

Some records in the table named OrderLines do not exist in the table named Order.

The column named OrderNumber must be a unique value in the Order table.

The OrderNumber column on the OrderLines table allows null values.

The OrderNumber column on the OrderLines table must be validated with the Order table.

Must not allow a new record in the OrderLines table that does not match a record in the Order table.

How should you complete the statements? To answer, select the appropriate transact-SQL segments from the drop-down menus in the answer area.

NOTE: Each correct selection is worth one point.

Answer:

Explanation:

Box 1: PRIMARY KEY

Box 2: NOCHECK Need NOCHECK as some records in the table named OrderLines do not exist in the table named Order.

Box 3: FOREIGN KEY FOREIGN KEY allows inserting NULL values if there is no NOT NULL constraint defined on this key, but the PRIMARY KEY does not accept NULLs.

References:

https://www.sqlshack.com/commonly-used-sql-server-constraints-foreign-key-check-default/

Leave a Reply

Your email address will not be published.