FAQ: Code Challenge: Queries - Code Challenge 1

This community-built FAQ covers the “Code Challenge 1” exercise from the lesson “Code Challenge: Queries”.

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

Web Development
Data Science

FAQs on the exercise Code Challenge 1

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!

Why is this valid (I know its asking for this)

SELECT year, number
FROM babies
WHERE name = 'Lillian';

SELECT year, number
FROM babies
WHERE name = 'Lillian' AND gender = 'F';

But this is not valid (other than the instructions ask otherwise)?

SELECT *
FROM babies
WHERE name = 'Lillian';
1 Like

I’m asking because the only added information returned is name and we are trying to find all with that name? Plus, it doesn’t return the number of entries, just the results of all with that name, minus the name.

1 Like

arguably it should be SUM(number) (therefore there’s no question of what to select)
Or if one specifically wanted to know year/number then yeah select those, not the whole row… But it is saying SUM

Find the number of girls who were named Lillian for the full span of time of the database.

1 Like

That to me makes more sense and should be the accepted answer versus the first snippet posted.

1 Like

Hi my code was as follows
select year, number
from babies
where gender = ‘F’ and name = ‘lillian’;

Instead of “Lillian” i wrote “lillian” which why i couldn’t retrieve the query so how do we retrieve such data in huge files with over 10000 plus entries where we don’t know if something is in capital or small letters

I also used SUM(number) initially. I think it’s not an accepted answer because they haven’t taught us “SUM” yet. In my opinion, this isn’t a very good example because the "accepted’ answer doesn’t actually output the total number of times the name Lillian was given.

1 Like

That is true I completely agree