CompTIA

DS0-001 practice question 14

CompTIA DataSys+ · free question 14 of 20

Question

A database administrator is migrating the information in a legacy table to a newer table. Both tables contain the same columns, and some of the data may overlap. Which of the following SQL commands should the administrator use to ensure that records from the two tables are not duplicated?
  • A. UNION Correct
  • B. JOIN
  • C. INTERSECT
  • D. CROSS JOIN

Explanation

UNION combines the result sets of two queries with the same columns and removes duplicate rows, so overlapping records appear only once (UNION ALL would keep them). INTERSECT returns only the rows present in both tables, losing the non-overlapping records, while JOIN and CROSS JOIN combine columns side by side rather than stacking rows.

Practice the whole free set

Answer all 20 free DS0-001 questions with instant feedback, or unlock all 139 questions with Learn and Exam modes.