Slideshow:
|
SELECT movieTitle FROM StarsIn WHERE starName IN (SELECT name // Sub-query FROM MovieStar WHERE birthday LIKE '%1960') |
The sub-query is uncorrelated because we can execute the sub-query without the outer query:
SELECT name FROM MovieStar WHERE birthday LIKE '%1960' |
That is because the sub-query does not use any attribute in the outer query !!!
Comment:
|
(Find movie title of movies with a star born in the year 1969) SELECT movieTitle FROM StarsIn WHERE starName IN (SELECT name // Uncorrelated Sub-query FROM MovieStar WHERE birthday LIKE '%1960') |
This is the initial query plan for the query
|
We will study query optimization more in dept later.
Employee: ssn fname lname --------- ------ -------- 123456789 John Smith 333445555 Frankl Wong 999887777 Alicia Zelaya 987654321 Jennif Wallace 666884444 Ramesh Narayan Dependent: essn name relationship --------- ---------- ------------ 333445555 Alice DAUGHTER 333445555 Joy SPOUSE 987654321 Abner SPOUSE 123456789 Micheal SON 123456789 Elizabeth SPOUSE |
|
SELECT fname, lname FROM employee WHERE ssn IN (SELECT essn // Uncorrelated Sub-query FROM dependent ) |
This is the initial query plan for the query
|
|