5/7 Correlated Subqueries I, Why use 'carrier' instead of another variable?


5/7 Correlated Subqueries I

Why do i have to use carrier = f.carrier as the filter variable? Is it because it might be a primary key? If that was the case wouldn't ID work just as well?

select id from flights as f where distance < 
      (select avg(distance) from flights   
             where carrier = f.carrier);


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.