Deferred Constraints

Note that multiple tuples will be returned if there

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ng null returns false regardless of the other operand). Note that multiple tuples will be returned if there are multiple students whose GPA are the highest. Page 3 of 4 select ct1.SID from course_taken ct1 group by (ct1.sid) having avg(ct1.grade) >= all (select avg(ct2.grade) from course_taken ct2 group by (ct2.sid) having avg(ct2.grade) is not null); --2: following the reasoning as we did in recitation 3 using relational algrebra: select ct1.sid from course_taken ct1 group by ct1.sid having avg(ct1.grade) = (select max(GPA) from ( select avg(ct2.grade) as GPA from course_taken ct2 group by ct2.sid ) ); __________________________________________________________________ 6. Find the top 3 students with the highest GPAs. --note that if all the will be null. Ordering Therefore, I specify a eliminate those tuples grades of a student is null, the average (GPA) by GPA, those with null GPA will appear first. condition "avg(grade) is not null" in order to with null GPA to appear in the result set. select * from ( select sid, avg(grade) as GPA from course_taken group by sid having avg(grade) is not null order by avg(grade)) where rownum <=3; Page 4 of 4...
View Full Document

This document was uploaded on 03/19/2014 for the course CS 1555 at Pittsburgh.

Ask a homework question - tutors are online