Skip to content
Worked Examples · Example 10

Q.Write an SQL query to display the Name and Marks of all students, arranged in descending order of Marks, from the Student table.

Maharashtra MsbshseTextbookSubjectiveImportance★★★★★est
93% · 13/14 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

To sort the output of a SELECT statement we add the ORDER BY clause, naming the field to sort on. DESC gives descending order (highest first); ASC (the default) gives ascending order.

Here we want the Name and Marks of all students, sorted from the highest marks down, so:

  1. Name the columns: SELECT Name, Marks.
  2. Give the table: FROM Student.
  3. Sort descending on marks: ORDER BY Marks DESC.

The complete query is:

SELECT Name, Marks FROM Student
ORDER BY Marks DESC;
``` …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.