Multiple choice technology web technology

which statements are true about ORDER BY clause?

  1. a)It can be used only once in compound query.

  2. The order by clause accepts the column name or an alias

  3. You can specify the order by clause in the subquery of a set operator.

  4. All the above

Reveal answer Fill a bubble to check yourself
A,B Correct answer
Explanation

In SQL, the ORDER BY clause can appear only once at the end of a compound query (using UNION, INTERSECT, or EXCEPT) to sort the final combined result. The ORDER BY clause accepts column names or aliases defined in the SELECT list. However, you cannot use ORDER BY in the subqueries that are part of set operators - it would only be allowed in the outer query or with TOP/N clauses in some databases.