Set Operators Flashcards
7 cards from real 1Z0-071 practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Set Operators flashcards as text
When using set operators, which columns must have compatible data types between the two SELECT statements?
Answer: All corresponding columns in both SELECT statements
Every corresponding column pair (column 1 with column 1, column 2 with column 2, and so on) must have compatible data types across both SELECT statements.
Which of the following is NOT a valid set operator in Oracle SQL?
Answer: INTERSECT ALL
Oracle SQL does not support INTERSECT ALL or MINUS ALL; the only valid set operators are UNION, UNION ALL, INTERSECT, and MINUS.
What is the result of the following query: SELECT 1 FROM DUAL UNION SELECT 1 FROM DUAL?
Answer: Returns one row containing the value 1
UNION eliminates duplicate rows, so even though both SELECT statements return the value 1, the final result contains only one distinct row.
In a compound query using set operators, an ORDER BY clause can reference output columns using which methods?
Answer: Column aliases from the first SELECT or position numbers
In set operator queries, ORDER BY can reference columns by aliases from the first SELECT statement or by their positional number; table-qualified names are not permitted.
Why is UNION generally slower in performance compared to UNION ALL?
Answer: UNION requires an additional sort and deduplication step to eliminate duplicate rows
UNION must perform an extra sort or hash operation to identify and remove duplicate rows from the combined result, adding overhead that UNION ALL avoids.
A business analyst needs to find all product IDs that appeared in January sales but did NOT appear in February sales. Which set operator is most appropriate?
Answer: MINUS
MINUS returns rows from the first query (January sales) that are not present in the second query (February sales), exactly matching the requirement to find the difference.
Which of the following correctly describes how set operators handle NULL values when comparing rows?
Answer: Set operators treat two NULL values as equal when determining row matches
Unlike most Oracle comparisons where NULL does not equal NULL, set operators (UNION, INTERSECT, MINUS) treat two NULL values as equal when determining whether rows match between the two result sets.