You need to ensure that if a supplier is deleted, the SupplierID value in the Product table is set to 0

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?

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?

A.
Create a default constraint on the SupplierID column in the Product table that sets the
value to 0. Set the ON DELETE property of the foreign key constraint to Default.

B.
Create a default constraint on the SupplierID column in the Product table that sets the
value to 0. Set the ON DELETE property of the foreign key constraint to NULL.

C.
Create a FOR DELETE trigger on the Supplier table that updates the SupplierID value to
0 in the Products table for the deleted supplier.

D.
Create a FOR DELETE trigger on the Product table that updates the SupplierID value to

0 in the Products table for the deleted supplier.



Leave a Reply 0

Your email address will not be published. Required fields are marked *