UNION or UNION ALL should be avoided ?
-
True
-
False
Reveal answer
Fill a bubble to check yourself
B
Correct answer
Explanation
UNION and UNION ALL are fundamental SQL operations with legitimate use cases. UNION eliminates duplicates and UNION ALL keeps all rows including duplicates. They should not be categorically avoided - the choice depends on whether you need duplicate elimination.
AI explanation
UNION and UNION ALL are standard, useful SQL constructs for combining result sets and shouldn't be avoided outright — the key is choosing the right one for the situation: UNION ALL when duplicates are acceptable or impossible (it's faster since it skips the dedup step), and UNION when you specifically need duplicates removed. Avoiding them entirely would just force worse alternatives like extra application-side merging logic.