Column and table.column confusion


#1

what is the difference between

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

and

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

Both yield different results

{
flights is table
distance and carrier are columns
}

It is the 5th topic of SQL - Table Transformations (CORRELATED SUBQUERIES I)


#2

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