FAQ: Queries - Review

This community-built FAQ covers the “Review” exercise from the lesson “Queries”.

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

Web Development
Data Science

Learn SQL

FAQs on the exercise Review

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!

Question about case statements - When you have multiple case statements, such as

Case
WHEN year > 2000 THEN ‘2000s’
WHEN year > 1990 THEN ‘90s’
ELSE ‘Older’
END AS ‘Decades’
FROM movies;

Does the second WHEN clause only included records that were not captured by the first WHEN clause, so that you don’t have movies from 2008 showing up labeled as 90’s? If not, is there a way to do that?

1 Like

Yes it does not include records already captured in the first clause because of the code arrangement (WHEN clause for > 2000 before WHEN clause > 1990). If the code is written otherwise i.e
WHEN year > 1990 THEN ‘90s’
WHEN year > 2000 THEN ‘2000s’ … the result would return 90s for year 2000 and later years

If caught in such a case, using BETWEEN clause for the years may be the option to go.

1 Like

How do I adjust number series in id column after deleting a row using DELETE FROM?
Example - I create a table of 500 rows, and later decided to delete row 247 using DELETE FROM

Hi,

I am not able to see any of the below SQL project, is there any problem with them?

https://discuss.codecademy.com/t/data-science-independent-project-1-watching-the-stock-market/419943
https://discuss.codecademy.com/t/data-science-independent-project-2-explore-a-sample-database/419945
https://discuss.codecademy.com/t/data-science-independent-project-3-education-census-data/419947

thanks

I have a question.
In the CASE structure and end as ‘Review’, a temporary Review column will be adđe to the table. However, when I select * from the table again, the Review column disappear.
My qs is that how can I add that Review column permanently (I cannot use alter/add column cause it won’t add any info in the column).
Thank you.

Question: Is it possible to query two fields, I am trying to run the below and coming back with a blank screen. Please can anyone help?

Thanks in advance ! :sweat_smile:

SELECT *
FROM movies
WHERE imdb_rating > 5
AND genre ‘action’;

Have a look at previous sections for any comparison operators. Your line: AND genre 'action' cannot be interpreted correctly as it is.