Answer: The GROUP BY Clause and the AVG Function
Understand how to group data in SQL using the GROUP BY clause combined with the AVG aggregate function. Explore solution techniques, including aliases and subqueries, to calculate averages within grouped data. Gain skills to handle variations like finding highest marks per subject, preparing you for common SQL interview questions.
Solution
The solution is given below:
Explanation
The explanation of the solution code is given below:
Line 2: The
SELECTquery finds the average of students’ marks for each subject using theAVG()function.Line 3: The
FROMclause specifies the table,StudentGrades.Line 4: ...