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.