Search⌘ K
AI Features

Question: The GROUP BY Clause and the AVG Function

Explore how to use the SQL GROUP BY clause combined with the AVG function to calculate the average marks for each subject from a student grades table. Learn to group data properly to gain insights into student academic performance efficiently.

Question

Given the following StudentGrades table structure:

StudentGrades

RecordID

StudentID

StudentName

Subject

Marks

1

st-101

Alexa

Mathematics

90.00

2

st-101

Alexa

Science

NULL

3

st-102

Diana

Mathematics

80.00

4

st-102

Diana

Science

88.00

5

st-103

Carl

Mathematics

NULL

6

st-103

Carl

Science

92.00

7

st-104

Sara

Mathematics

75.00

8

st-104

Sara

Science

85.00

9

st-105

Karen

Mathematics

85.00

10

st-105

Karen

Science

90.00

Additional information

You are provided with a table named StudentGrades that contains the following columns: ...