Why is this part of the code needed?


In this code I am not understanding why the text that is surrounded by "**" is needed. Why are we calling the table f? Then why are we saying "Where carrier = f.carrier"? All this code occurs in the same table so I don't understand the need for it. It is basically saying this column is equal to the same column, right?

FROM flights **AS f**
WHERE distance > (
 SELECT AVG(distance)
 FROM flights
 **WHERE carrier = f.carrier)**;


In objective terms as I read it, f is a member of flights. f.carrier would then be that column in the flights table corresponding to row f It would imply an interative processs.


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