KnowledgeBoat Logo
|

Informatics Practices

If column emp_id contains the following set {9, 7, 6, 4, 3, 1, 2}, what will be the output on execution of the given query?

SELECT emp_id 
FROM person 
ORDER BY emp_id;

(a) {9, 7, 6, 4, 3, 1, 2}

(b) {1, 2, 3, 4, 6, 7, 9}

(c) {2, 1, 4, 3, 7, 9, 6}

(d) None of these

SQL Queries

1 Like

Answer

{1, 2, 3, 4, 6, 7, 9}

Reason — The ORDER BY clause in SQL sorts the result set based on the specified column(s) in ascending order by default. In the given query, the emp_id column is specified in the ORDER BY clause. Therefore, the query will sort the emp_id values in ascending order.

Answered By

1 Like


Related Questions