PROFESSIONAL-CLOUD-DEVELOPER · Question #61
You have two tables in an ANSI-SQL compliant database with identical columns that you need to quickly combine into a single table, removing duplicate rows from the result set. What should you do?
The correct answer is D. Use the UNION operator in SQL to combine the tables.. A is not correct because UNION ALL does not remove duplicates. B is not correct because there is no indication of a column to potentially join on. C is not correct because WITH statements simply define query results as an intra-statement D is correct because the UNION operator co
Question
You have two tables in an ANSI-SQL compliant database with identical columns that you need to quickly combine into a single table, removing duplicate rows from the result set. What should you do?
Options
- AQuery the tables from a Linux shell, combine the results into a single CSV, and re-import the rows
- BUse the JOIN operator in SQL to combine the tables.
- CUse nested WITH statements to combine the tables.
- DUse the UNION operator in SQL to combine the tables.
How the community answered
(52 responses)- A2% (1)
- B2% (1)
- C4% (2)
- D92% (48)
Explanation
A is not correct because UNION ALL does not remove duplicates. B is not correct because there is no indication of a column to potentially join on. C is not correct because WITH statements simply define query results as an intra-statement D is correct because the UNION operator combines result sets while removing duplicates.
Topics
Community Discussion
No community discussion yet for this question.