Given a table Employee having columns empName and empId, what will be the result of the SQL query below?

 select empName from Employee order by 2 desc;

asked in Database Questions by
0 votes

1 Answer

answered by

"Order by 2” is only valid when there are at least two columns being used in select statement. However, in this query, even though the Employee table has 2 columns, the query is only selecting 1 column name, so “Order by 2” will cause the statement to throw an error while executing the above sql query.

0 votes
...