PdfPrep.com

Which three Transact-SQL segments should you use to develop the solution?

DRAG DROP

You develop a Microsoft SQL Server Database.

The database contains a table named Status that is defined by the following Transact-SQL statement:

There are thousands of rows in the Status table, with significant duplication of data in the Color column. Ninety percent of the rows in the table have Color="Red", and the remaining 10 percent have Color="Green".

You want to normalize the Color information in this table.

You create a table named Colors that is defined by the following DDL:

You populate the new Colors table by using the following Transact-SQL statement:

INSERT Colors (ColorName) SELECT DISTINCT Color FROM Status

You need to ensure that the following requirements are met:

– The Status table uses only colors that exist in the Colors table.

– Data redundancy in the Status table is reduced.

– Data integrity is enforced during the normalization process.

Which three Transact-SQL segments should you use to develop the solution? To answer, move the appropriate Transact-SQL segment from the list of Transact-SQL segments to the answer area and arrange them in the correct order.

Answer:

Explanation:

First update the new column ColorID, and drop the old Column Color.

Add a check constraint on the new ColorID column, and finally add a foreign key constraint.

Exit mobile version