Question 2 non corelated subquries


#1

<Hi Im stuck at question 2 ,

https://www.codecademy.com/en/courses/sql-table-transformation/lessons/subqueries/exercises/non-correlated-i?action=resume

Below is the code I used but for some reason it does not work for the question being asked
(Using the same pattern from the example above, find flight information about flights where the origin elevation is less than 2000 feet.)

To me it seemed it like just changing the comparison expression to smaller than.

Does any one know how what is being asked and how to perform the code?

SELECT * 
FROM flights WHERE origin in (
SELECT code 
FROM airports 
WHERE elevation < 2000);



Replace this line with your code.

#2

I have no idea why this works, and the code you posted doesn't. If anyone could explain that would be awesome

SELECT * FROM flights WHERE origin in
(SELECT code FROM airports WHERE elevation < 2000);


#3

This variation also worked for me:

SELECT * FROM flights WHERE origin in (
    SELECT code 
    FROM airports 
    WHERE elevation < 2000);

I originally tried this below code but it didn't work. I don't understand why the below nor OP's answer works when it's all the exact same?

SELECT * 
FROM flights 
WHERE origin in (
    SELECT code 
    FROM airports 
    WHERE elevation < 2000);

#4

Thanks guys for having a look .
It's weird , I had to restart the browser and the exact code worked .this keeps happening even with the other questions .it makes you wonder if weather the code was correct


#5

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