

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


3
FROM Enroll, Course WHERE Enroll.CID = Course.CID;
< select-list > < from-list >
< where-cond >
< table > < table >
< Query >
Enroll Course
PROJECT ( title , SID ) MERGE-JOIN ( CID )
SCAN ( Enroll )
SCAN ( Course )
Enroll Course
4
5
Enroll
Enroll
Course
Student
6
PROJECT ( title ) INDEX-NESTED-LOOP-JOIN ( CID )
Index on Enroll( SID )
Index on Course ( CID )
Index on Student ( name )
INDEX-SCAN ( name = “Bart”)
PROJECT ( title ) MERGE-JOIN ( CID )
SORT ( CID )SCAN (Course) MERGE-JOIN ( SID )
SCAN ( Enroll )
SCAN ( Student )
FILTER ( name = “Bart”)
SELECT Course.title FROM Student, Enroll, Course WHERE Student.name = ‘Bart’ AND Student.SID = Enroll.SID AND Enroll.CID = Course.CID;
9
10
11
R.open(); S.open(); r = R.getNext();
do { s = S.getNext(); if (s == null) { S.close(); S.open(); s = S.getNext(); if (s == null) return null; r = R.getNext(); if (r == null) return null; } } until (r joins with s); return rs;
R.close(); S.close();
12