Q1
True / FalseThe UNION keyword combines results from multiple SELECT statements and removes duplicate rows by default.
The UNION keyword combines results from multiple SELECT statements and removes duplicate rows, which is why it returns only distinct rows.
Q2
True / FalseUNION ALL will return only unique rows from the combined SELECT statements.
UNION ALL returns all rows from the combined SELECT statements, including duplicates. It does not filter out duplicate rows.
Q3
True / FalseUsing UNION requires that all SELECT statements have the same number of columns with compatible data types.
For UNION to work, each SELECT statement must have the same number of columns, and the data types of the columns must be compatible.
Q4
True / FalseUNION ALL is more performant than UNION because it does not remove duplicate rows.
UNION ALL is generally more performant than UNION because UNION ALL does not require the database to perform the additional work of removing duplicate rows.
Q5
True / FalseThe number of columns in each SELECT statement is not important when using UNION.
The number of columns must be the same in each SELECT statement when using UNION or UNION ALL. The columns must also have compatible data types.
Q6
True / FalseUNION ALL can be used to combine results from SELECT statements with different column names.
UNION ALL can combine results even if the column names are different, as long as the number and data types of columns match across SELECT statements.
Q7
True / FalseIn a UNION ALL operation, if one of the SELECT statements has a WHERE clause, it will not affect the other SELECT statements.
In a UNION ALL operation, each SELECT statement operates independently, so the WHERE clause in one SELECT statement does not affect the others.
Q8
True / FalseUsing UNION ALL with large datasets might result in performance issues due to duplicate rows being included.
UNION ALL includes all rows from the combined SELECT statements, which can lead to performance issues if the datasets are large and include many duplicate rows.
Q9
True / FalseUNION and UNION ALL are both set operations that can be used to combine the results of multiple SELECT queries.
Both UNION and UNION ALL are set operations used to combine the results of multiple SELECT queries, but UNION removes duplicates while UNION ALL includes all rows.
Q10
True / FalseUNION cannot be used if the SELECT statements have different numbers of columns.
UNION requires that all SELECT statements have the same number of columns with compatible data types. If the number of columns differs, UNION will not work.
Q11
True / FalseThe ORDER BY clause in a UNION query affects only the final result set, not the individual SELECT statements.
When using UNION, the ORDER BY clause is applied to the final result set after the individual SELECT statements have been combined. It does not affect the order of rows in the individual SELECT statements.
Q12
True / FalseUNION ALL will return rows in the order they appear in the SELECT statements, without sorting them.
UNION ALL returns rows in the order they appear in the SELECT statements unless an ORDER BY clause is used. It does not sort the results by default.
Q13
True / FalseUsing UNION ALL between two queries with different column names will result in an error.
UNION ALL does not require the column names to be the same between queries, but the number and data types of columns must match.
Q14
True / FalseUNION ALL is less efficient than UNION when dealing with large datasets due to the additional processing required to remove duplicates.
UNION ALL does not perform any duplicate removal, making it more efficient than UNION, which involves additional processing to remove duplicates.
Q15
True / FalseYou can use UNION ALL to combine result sets from SELECT statements with different column names as long as the data types match.
UNION ALL requires that the number and data types of columns match across all SELECT statements, but the column names do not have to be the same.