Identify the most suitable SQL command to display the merit list of students…
2022
Identify the most suitable SQL command to display the merit list of students where details are shown in descending order of MARKS, and if MARKS are same, then in ascending order of ROLLNO.
ROLLNO | NAME | SEC | MARKS |
|---|---|---|---|
80105 | MARIA | A | 83.0 |
80108 | AMAR | B | 44.0 |
80109 | MANPREET | A | 92.0 |
80112 | SAMEER | A | 81.0 |
80115 | AKBAR | B | NULL |
- A.
SELECT * FROM MYSTUDENT ORDER BY DESC MARKS, ASC ROLLNO;
- B.
SELECT * FROM MYSTUDENT ORDER BY MARKS DESC, ROLLNO ASC;
- C.
SELECT * FROM MYSTUDENT ORDER BY MARKS, ROLLNO DESC, ASC;
- D.
SELECT * FROM MYSTUDENT ORDER BY MARKS DESC; ROLLNO ASC;
Attempted by 1844 students.
Show answer & explanation
Correct answer: B
ORDER BY MARKS DESC sorts students by marks from highest to lowest. ROLLNO ASC ensures that when marks are the same, students are ordered by roll number in increasing order.
A video solution is available for this question — log in and enroll to watch it.