Ask a Question
  
  
  
Top Posters
Since Sunday
24
15
11
10
9
9
9
8
8
7
7
7
New Topic  
wrote...
Posts: 42
6 days ago
What is a correlated subquery? Include an example.
Source  Download Study Guide
Database Processing: Fundamentals, Design, and Implementation
Edition: 15th
Authors:
Read 5 times
1 Reply
Replies
Answer verified by a subject expert
wrote...
Posts: 41
6 days ago
Sign in or Sign up in seconds to unlock everything on Biology Forums.
A correlated subquery uses the standard SQL subquery structure of a SELECT statement (called the lower SELECT) within the WHERE clause of a controlling (or upper) SELECT. However, where a non-correlated subquery uses different tables in the upper and lower SELECTS, the correlated subquery uses the same table in both SELECTS. SQL aliases are used to provide different table names within the query. When a non-correlated subquery is processed, the lower SELECT is processed first, and the entire result set of the lower SELECT is passed to the upper SELECT. When a correlated subquery is processed, a nested processing is used where each individual result of the lower SELECT is returned one at a time to the upper SELECT for processing. Here is an example that finds the last names of all students advised by a faculty whose last name is 'Smith':
SELECT S.LastName
FROM Student as S
WHERE EXISTS
(SELECT *
FROM FACULTY as F
WHERE F.FacultyID = S.AdvisorID AND F.LastName = 'Smith'));
This verified answer contains over 290 words.
Related Topics
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers.
Learn More
Improve Grades
Help Others
Save Time
Accessible 24/7
  178 People Browsing
 118 Signed Up Today
Related Images
 731
 85
 28
Your Opinion
Who's your favorite biologist?
Votes: 14