This question is based on the following SQL table MYSTUDENT . ROLLNO NAME SEC…

2022

This question is based on the following SQL table 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 students’ marks?

  1. A.

    SELECT SEC, AVG(MARKS) FROM MYSTUDENT ORDER BY SEC;

  2. B.

    SELECT SEC, AVG(MARKS) FROM MYSTUDENT GROUP BY MARKS;

  3. C.

    SELECT SEC, AVG(MARKS) FROM MYSTUDENT GROUP BY SEC;

  4. D.

    SELECT AVG(MARKS) FROM MYSTUDENT ORDER BY SEC;

Attempted by 1253 students.

Show answer & explanation

Correct answer: C

To calculate averages group-wise, SQL requires the GROUP BY clause. Since the average is required section-wise, grouping must be done on SEC. Therefore, the correct command is: SELECT SEC, AVG(MARKS) FROM MYSTUDENT GROUP BY SEC;

Explore the full course: Up Lt Grade Assistant Teacher 2025