Which of the following command can display the SEC-wise average of the students?
2023
Which of the following command can display the SEC-wise average of the students?
Answer: C. SELECT SEC, AVG(MARKS) FROM MYSTUDENT GROUP BY SEC; — Key idea: group rows by SEC so AVG(MARKS) is computed for each section. Use this SQL command: SELECT SEC, AVG(MARKS) FROM MYSTUDENT GROUP BY SEC; GROUP BY SEC…
- A.
SELECT SEC, AVG(MARKS) FROM MYSTUDENT ORDER BY SEC;
- B.
SELECT SEC, AVG(MARKS) FROM MYSTUDENT GROUP BY MARKS;
- C.
SELECT SEC, AVG(MARKS) FROM MYSTUDENT GROUP BY SEC;
- D.
SELECT AVG(MARKS) FROM MYSTUDENT ORDER BY SEC;
Attempted by 1802 students.
Show answer & explanation
Correct answer: C
Key idea: group rows by SEC so AVG(MARKS) is computed for each section. Use this SQL command: SELECT SEC, AVG(MARKS) FROM MYSTUDENT GROUP BY SEC; GROUP BY SEC ensures one result row per section.
A video solution is available for this question — log in and enroll to watch it.