Find the total marks in Maths only using SQL.
💡 Model Answer
To calculate the total Maths marks, use a simple SUM with a WHERE clause:
SELECT SUM(marks) AS total_math
FROM student_marks
WHERE subject = 'Maths';
This query scans the student_marks table, filters for rows where subject equals 'Maths', and sums the marks column. The operation is linear in the number of rows, so its time complexity is O(n). If the table is large, ensure there is an index on the subject column to accelerate the filter. The result is a single numeric value representing the combined Maths marks for all students.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.
Get Assisting AI — Starts at ₹500