Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLUNION vs UNION ALLSingle-choice MCQ

In a UNION query, where may an ORDER BY clause legally appear, and what may it reference?

SELECT a AS x FROM t1 UNION ALL SELECT b FROM t2 ORDER BY x;