CJCoding With Joseph
15free / daySign inCreate account
TitleOpen
50
Number the Students by GPAGive every student with a known gpa a position with ROW_NUMBER(): return rn, first_name, last_name and gpa, numbering from the highest gpa down and breaking ties on id so each number is fixed.
easyNot startedSolve
51
Rank Versus Dense RankShow how the two ranking functions differ on tied grade point averages.
easyNot startedSolve
52
Running Total of Course FeesList the courses in id order with a running total of their fees: return id, code, fee and running_total, where running_total is the sum of fee over every course from the first row up to and including the current one.
easyNot startedSolve
53
Rank Students Within Their CityRank the students inside their own city rather than across the whole college: return city, first_name, last_name, gpa and city_rank, where city_rank is RANK() by gpa descending restarted for each city.
mediumNot startedSolve
54
Each Salary and the Next Lower OneList the instructors from the best paid down: return first_name, last_name, salary, next_lower (the salary on the following row, via LEAD()) and gap (the current salary minus next_lower).
mediumNot startedSolve
55
Quartiles and Distance From the AverageFor every student with a known gpa, return first_name, last_name, gpa, quartile (NTILE(4) by gpa descending, ties broken by id, so the top quarter is 1), avg_gpa (the average gpa of all these students, rounded to 2 places and repeated on every row) and diff (this student's gpa minus that average, rounded to 2 places).
mediumNot startedSolve
56
Top Two Students in Each MajorFind the two students with the highest gpa in every major.
hardNot startedSolve
57
Each Department's Share of the StudentsReport how the student body splits across majors: return department (the department name, or Undeclared for the four students with no major), students (how many) and pct_of_total (that count as a percentage of all 30 students, rounded to 1 place).
hardNot startedSolve