70-451 · Question #18
You are a database developer. You plan to design a database solution by using SQL Server 2008. The database contains two tables named Supplier and Product. There is a foreign key constraint between…
The correct answer is D. Create a default constraint on the SupplierID column in the Product table that sets the value. See the full explanation below for the reasoning.
Question
You are a database developer. You plan to design a database solution by using SQL Server 2008. The database contains two tables named Supplier and Product. There is a foreign key constraint between the Supplier and Product tables on the SupplierID column. The Supplier table contains a row that has the SupplierID value as 0. The 0 value indicates that the supplier is deleted. Certain transactions delete the supplier records from the Supplier table. You need to ensure that if a supplier is deleted, the SupplierID value in the Product table is set to 0. What should you do?
Options
- ACreate a FOR DELETE trigger on the Product table that updates the SupplierID value to 0
- BCreate a FOR DELETE trigger on the Supplier table that updates the SupplierID value to 0
- CCreate a default constraint on the SupplierID column in the Product table that sets the value
- DCreate a default constraint on the SupplierID column in the Product table that sets the value
How the community answered
(24 responses)- A8% (2)
- B13% (3)
- C4% (1)
- D75% (18)
Community Discussion
No community discussion yet for this question.