Q150 Examine this SQL statement:
SELECT cust_id, cust_last_name "Last Name" FROM customers WHERE country_id = 10 UNION SELECT cust_id CUST_NO, cust_last_name FROM customers WHERE country_id = 30
Identify three ORDER BY clauses, any one of which can complete the query successfully. (Choose three.)
- A) ORDER BY “Last Name”
- B) ORDER BY 2, 1
- C) ORDER BY 2, cust_id
- D) ORDER BY CUST_NO
- E) ORDER BY “CUST_NO”
Answer: A,B,C
Explanation:
https://oracle-base.com/articles/misc/sql-for-beginners-set-operators
https://www.w3schools.com/sql/sql_union.asp
Using ODER BY in UNION CLAUSE: Columns in the ORDER BY clause can be referenced by column names or column aliases present in the first query of the statement, as these carry through to the final result set.