You are a database administrator for AIOTestKing.com. A SQL Server 2005 computer named AIOTestKing A has a database named Inventory. AIOTestKing A is responsible for aggregating manufacturing part numbers from your company’s trading partners. The manufacturing part numbers are stored in the Product table in the Inventory database. Every night, data is sent as text files from each trading partner to AIOTestKing.
You need to import data and ensure that no duplicate manufacturing part numbers exist in the data imported from the text files that are stored in the Inventory database on AIOTestKing.
You want to achieve this goal with the minimum amount of impact on your company’s trading partners and your IT department. What should you do?
A.
Ensure that each of your company’s trading partners uses unique key values for manufacturing part numbers. Then, import the text files into the Product table.
B.
Ensure that each text file is stored in an Extensible Markup Language (XML) file. Use Extensible Stylesheet Language Transformations (XSLT) to automatically remove duplicates before data is imported into the Product table.
C.
Import the data from each text file into a staging table. Write a query to include a HAVING clause to remove duplicate values before inserting results into the Product table.
D.
Place a unique index on the PartNum column.
Explanation:
In this particular case a staging table that removes all duplicates with a T-SQL query including the HAVING clause would solve the problem with least impact on your company’s trading partners. HAVING specifies a search condition for a group or an aggregate. HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause.