FAQ: Subqueries - Correlated Subqueries II

This community-built FAQ covers the “Correlated Subqueries II” exercise from the lesson “Subqueries”.

Paths and Courses
This exercise can be found in the following Codecademy content:

SQL: Table Transformation

FAQs on the exercise Correlated Subqueries II

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

15 posts were merged into an existing topic: Detailed explanation of the code

9 posts were split to a new topic: What alias-ing is going on here?

Hey guys.

I came up with a slightly different code and although it seemed to work, codecademy didn’t really accept it as an answer. I was just wondering if it is objectively WRONG or it was just something the server wasn’t expecting.

SELECT origin, id, (
FROM flights AS a
WHERE a.id <= flights.id 'as you can see I added the ‘<=’ operator
AND a.origin = flights.origin) 'and I removed the incremental +1
AS flight_sequence_number
FROM flights
ORDER BY origin, id; 'and here’s a suggestion to add to the example to make it clearer as to its objective

It doesn’t seem possible to me that this code could yield a different query than the expected input.

These questions just seem to get more and more vague. Very poor course!


A post was split to a new topic: Detailed explanation of the code

A post was merged into an existing topic: What alias-ing is going on here?

nakkivaan and nessie2015 - great explanation of the complicated code.

You’ve made me smile after feeling sad.