Write a SQL query to identify students whose GPA improved each semester using a running total or lag/lead approach for UNC Chapel Hill.
Use the provided student, academic term, and semester GPA data. Include students with at least three consecutive semesters and exclude any student with a missing GPA, missing term, or non-improving semester.
student_id, student_name, semesters_completed, starting_gpa, and ending_gpa.student_id ascending.| Column | Type | Description |
|---|---|---|
| student_idPK | INT | Unique UNC Chapel Hill student identifier |
| student_name | VARCHAR(100) | Student's full name |
| Column | Type | Description |
|---|---|---|
| term_idPK | INT | Unique academic term identifier |
| term_name | VARCHAR(50) | Readable academic term name |
| term_order | INT | Chronological sequence of the term |
| Column | Type | Description |
|---|---|---|
| student_idPK | INT | Student receiving the GPA record |
| term_idPK | INT | Academic term for the GPA |
| gpa | NUMERIC(3,2) | Semester GPA on a 0.00 to 4.00 scale |