write a query to display the sum of all the marks in the table student in each class
Share
write a query to display the sum of all the marks in the table student in each class
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
We have seen how the sum function is used to get the total value of a column in a mysql table. Now we will learn how to get the query for sum in multiple columns and for each record of a table. For a better understanding we will change our student table a bit by adding marks in different subjects for each record. Now the table will be like this.
id name class social science math
2 Max Ruin Three 85 56 85
3 Arnold Three 55 40 75
4 Krish Star Four 60 50 70
5 John Mike Four 60 80 90
6 Alex John Four 55 90 80
7 My John Rob Fifth 78 60 70
8 Asruid Five 85 80 90
9 Tes Qry Six 78 60 70
10 Big John Four 55 40 50