Multiple choice technology databases

Which of the following is the correct usage of Order by

  1. select col1,col2 from table_a order by col2,col1 desc

  2. select col1,col2 from table_a order by 2,col1 desc

  3. select col1,col2 from table_a order by 2,1

  4. select col1,col2 from table_a order by 1,col2

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

ORDER BY accepts column names (option A) or ordinal positions (option C). Options B and D incorrectly mix ordinal positions with column names in a way that breaks SQL syntax consistency in some databases.