Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT students.Vnum,
- students.first_name,
- students.last_name,
- sum(tuition.price_per_unit) IF sum(tuition.price_per_unit) > 2000 AS total_paid
- FROM students, courses, tuition, grades
- WHERE tuition.course_code = courses.course_code, --Match basics so our data isn't garbage
- tuition.course_code = grades.course_code,
- 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
- tuition.course_num = grades.course_num,
- grades.Vnum = students.Vnum
- GROUP BY students.Vnum
- ORDER BY total_paid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement