Problem: Compute Student CGPA
In this project, you’ll compute each student’s CGPA (Cumulative Grade Point Average) based on their SGPA across multiple semesters. This is a common real-world use case in education analytics and reporting systems.
Database schema
You’ll work with these two tables:
1. students table
ID | Name | Class |
1001 | James | 9A |
1002 | Olivia | 9A |
1003 | Ethan | 9B |
1004 | Sophia | 9A |
1005 | Liam | 9B |
2. semesters table
StudentID | Semester | SGPA |
1001 | 1 | 3.8 |
1001 | 2 | 3.6 |
1002 | 1 | 3.9 |
1002 | 2 | 4.0 |
1003 | 1 | 3.0 |
1004 | 1 | 3.7 |
1004 | 2 | 3.9 |
1004 | 3 | 3.8 |
CGPA formula
CGPA = (Sum of all SGPAs) / (Number of semesters attempted)
Each SGPA is a GPA value for one semester. To calculate CGPA, you simply take the average of all SGPA values recorded for that student.
In this version, there’s no need to weight by credit hours; we assume all semesters are equally weighted.
Example:
Let’s say James has the following SGPAs:
Semester 1: 3.7
Semester 2: 3.9
Semester 3: 3.8
Then her CGPA is:
CGPA = (3.7 + 3.9 + 3.8) / 3 = 3.80
Task: Compute CGPA for each student
Goal: Calculate the average SGPA across all recorded semesters for each student.
Try to:
Use
AVG(SGPA)grouped by student.Include the student's name in the result.
Optionally round the CGPA to 2 decimal places using
ROUND().
Problem: Compute Student CGPA
In this project, you’ll compute each student’s CGPA (Cumulative Grade Point Average) based on their SGPA across multiple semesters. This is a common real-world use case in education analytics and reporting systems.
Database schema
You’ll work with these two tables:
1. students table
ID | Name | Class |
1001 | James | 9A |
1002 | Olivia | 9A |
1003 | Ethan | 9B |
1004 | Sophia | 9A |
1005 | Liam | 9B |
2. semesters table
StudentID | Semester | SGPA |
1001 | 1 | 3.8 |
1001 | 2 | 3.6 |
1002 | 1 | 3.9 |
1002 | 2 | 4.0 |
1003 | 1 | 3.0 |
1004 | 1 | 3.7 |
1004 | 2 | 3.9 |
1004 | 3 | 3.8 |
CGPA formula
CGPA = (Sum of all SGPAs) / (Number of semesters attempted)
Each SGPA is a GPA value for one semester. To calculate CGPA, you simply take the average of all SGPA values recorded for that student.
In this version, there’s no need to weight by credit hours; we assume all semesters are equally weighted.
Example:
Let’s say James has the following SGPAs:
Semester 1: 3.7
Semester 2: 3.9
Semester 3: 3.8
Then her CGPA is:
CGPA = (3.7 + 3.9 + 3.8) / 3 = 3.80
Task: Compute CGPA for each student
Goal: Calculate the average SGPA across all recorded semesters for each student.
Try to:
Use
AVG(SGPA)grouped by student.Include the student's name in the result.
Optionally round the CGPA to 2 decimal places using
ROUND().