34.9k views
5 votes
To combine the results of two or more select statements, removing duplicates, which keyword can you use?

A. UNION
B. INTERSECT
C. EXCEPT
D. JOIN

1 Answer

1 vote

Final answer:

To combine the results of multiple select statements and remove duplicates, the keyword to use is UNION. It requires that each select statement has the same number of columns with compatible data types. UNION ALL, INTERSECT, and EXCEPT have distinct functionalities, such as not removing duplicates or selecting specific subsets of records.

Step-by-step explanation:

To combine the results of two or more select statements, while removing duplicates, the keyword you can use is UNION. This command is used in SQL (Structured Query Language), which is the standard language for relational database management systems. When using UNION, it is important to ensure that all select statements involved have the same number of columns in the result sets, and corresponding columns have compatible data types.

The UNION keyword is different from UNION ALL, which also combines the results of two or more select statements but does not remove duplicates. Additionally, the other options, such as INTERSECT and EXCEPT, have their own specific uses. The INTERSECT keyword returns only the records common to both Select statements, while EXCEPT returns only the records from the first select statement that are not present in the second one. Finally, JOIN is used to combine rows from two or more tables, based on a related column between them.

User SDJSK
by
7.2k points