Question 11

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 Which of the following command can display the SEC wise Average of the student ?
  1. ASELECT SEC, AVG (MARKS) FROM MYSTUDENT ORDER BY SEC;
  2. BSELECT SEC, AVG (MARKS) FROM MYSTUDENT GROUP BY MARKS;
  3. CSELECT *SEC, AVG (MARKS) FROM MYSTUDENT GROUP BY SEC;
  4. DSELECT AVG (MARKS) FROM MYSTUDENT ORDER BY SEC;
Show answerHide answer

Correct answer: (C) SELECT *SEC, AVG (MARKS) FROM MYSTUDENT GROUP BY SEC;

Explanation

Section-wise averages need GROUP BY SEC with SELECT SEC, AVG(MARKS); ORDER BY only sorts and does not form groups, and GROUP BY MARKS groups the wrong column. Option C is the intended query (the "*" is a printing slip).

From DSSSB TGT Computer Science Practice Set 5

This is question 11 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.