Answer: The GROUP BY Clause and the AVG Function
Explore how to use the SQL GROUP BY clause alongside the AVG function to calculate average values grouped by specific columns. Understand how aggregate functions and aliases work within queries, and learn alternative methods like using DISTINCT with subqueries. This lesson prepares you to handle common SQL interview questions involving data grouping and averaging.
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: ...