Question: Sorting and Calculations
Explore how to use SQL sorting, filtering, and aggregate functions to retrieve meaningful insights from student exam data. Learn to write queries that identify top performers by calculating cumulative marks, handle NULL values, and apply sorting to achieve the desired results.
We'll cover the following...
Question
Given the following StudentGrades table structure:
StudentGrades
RecordID | StudentID | StudentName | Subject | TheoryMarks | PracticalMarks |
1 | st-101 | Alexa | Mathematics | 90 | NULL |
2 | st-101 | Alexa | Science | NULL | 80 |
3 | st-102 | Diana | Mathematics | 80 | NULL |
4 | st-102 | Diana | Science | 88 | 60 |
5 | st-103 | Carl | Mathematics | NULL | NULL |
6 | st-103 | Carl | Science | 92 | 90 |
7 | st-104 | Sara | Mathematics | 75 | NULL |
8 | st-104 | Sara | Science | 85 | 95 |
9 | st-105 | Karen | Mathematics | 85 | NULL |
10 | st-105 | Karen | Science | 90 | 70 |
Additional information
You are provided with a table named StudentGrades that contains the following columns: