Question 10

This question is based on the following SQL Table. Mr. Aman, a Computer Science Teacher maintains the details of his class 12 Students is a SQL table as…

This question is based on the following SQL Table. Mr. Aman, a Computer Science Teacher maintains the details of his class 12 Students is a SQL table as follow : Table Name : MYSTUDENT 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 Identify the most Suitable Command to display the merit List of his students where the details will be displayed in descending order of their marks. If some students have same MARKs, their detail will be displayed in ascending order of their ROLLNO.
  1. ASELECT * FROM MYSTUDENT ORDER BY DESC MARKS, ASC ROLLNO;
  2. BSELECT * FROM MYSTUDENT ORDER BY MARKS DESC, ROLLNO ASC;
  3. CSELECT * FROM MYSTUDENT ORDER BY MARKS; ROLLNO DESC, ASC;
  4. DSELECT * FROM MYSTUDENT ORDER BY MARKS DESC; ROLLNO ASC;
Show answerHide answer

Correct answer: (B) SELECT * FROM MYSTUDENT ORDER BY MARKS DESC, ROLLNO ASC;

Explanation

ORDER BY takes the column first and the direction after it, separated by commas: ORDER BY MARKS DESC, ROLLNO ASC sorts by marks high to low and breaks ties by roll number ascending. The other options have wrong syntax.

From DSSSB TGT Computer Science Practice Set 5

This is question 10 of DSSSB TGT Computer Science Practice Set 5. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.