Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.60 KB | None | 0 0
  1. SELECT  students.Vnum,
  2.         students.first_name,
  3.         students.last_name,
  4.         sum(tuition.price_per_unit) IF sum(tuition.price_per_unit) > 2000 AS total_paid
  5.  
  6. FROM    students, courses, tuition, grades
  7.  
  8. WHERE   tuition.course_code = courses.course_code, --Match basics so our data isn't garbage
  9.         tuition.course_code = grades.course_code,
  10.         tuition.course_num = courses.course_num, --I'm not sure what the difference between course_code and course_num is so I'm matching both to be safe
  11.         tuition.course_num = grades.course_num,
  12.         grades.Vnum = students.Vnum
  13.        
  14. GROUP BY students.Vnum
  15. ORDER BY total_paid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement