Solution: Compute Student CGPA
Explore how to compute the cumulative GPA for students by joining student and semester data, applying aggregation functions, grouping results accurately, and sorting the output to highlight top performers using SQL.
We'll cover the following...
We'll cover the following...
Query
SELECTs.Name,ROUND(AVG(se.SGPA), 2) AS CGPAFROM students sJOIN semesters se ON s.ID = se.StudentIDGROUP BY s.ID, s.NameORDER BY CGPA DESC;
Explanation
This query calculates the CGPA (Cumulative Grade Point Average) for each student by taking the average of all their ...