CBSE Class 12 Informatics Practices Question 8 of 90

Querying Using SQL — Question 1

Back to all questions
1
Question

Question 1

Can you arrange the result set of an SQL query on multiple columns ?

Answer

Yes, we can arrange the result set of an SQL query on multiple columns. We should specify the multiple column names in the ORDER BY clause along with the desired sort order.

For example, the following statement will sort the records in the data table first by the section column in ascending order and then by the marks column in descending order.

SELECT * FROM data
ORDER BY section ASC, marks DESC;