Confusing Project: Building an Inventory Database with PostgreSQL

This has been one of the most frustrating projects on Codecademy.

Every step is totally unclear and when you check the hint, you’re still confused because of Codecademy giving you portions of the hint and telling you to fill in the parts.

This is the start of learning a new language and these kinds of projects totally destroy learners’ motivation to go on.

I myself have no idea what step 15 is telling me to do and even the hint is more confusing:

Update the old manufacturers’ parts in ‘parts’ to reference the new company you’ve just added to ‘manufacturers’.

We need to find a way to select the old manufacturers’ rows in parts and replace them with the new. We can use manufacturer_id to select these rows. Fill in the code below to update parts .

UPDATE partsSET manufacturer_id = 11
WHERE manufacturer_id IN (____, ____);

I have no idea why I’m being asked to do something that hasn’t been taught in the first place!

I really don’t know how to complete this step and what I’m supposed to put in here:

WHERE manufacturer_id IN (____, ____);

Codecademy must fix its Back-End courses (first Express and now this!).

1 Like

What is the link to the course lesson?
So, you have not covered IN and NOT IN operators so far?

This is the link to the project:
Building an Inventory Database with PostgreSQL

And no there wasn’t any mention of the functionality of IN and NOT IN operators in the lessons prior to the project.

But you were able to complete all the (14) steps prior? what have you tried for this last step?

Basically IN and NOT IN is testing for True or False, row by row, based on the conditions you provide.

So, you’re updating the manufacturer_id for all the rows that have the old id, or, match the condition you provide.

Update: I just went through and did this project (even though I’m not doing the Full Stack path, some parts of this SQL stuff are marked as complete for me b/c I did complete them elsewhere). One thing that I noticed is that the cheatsheet and the lessons prior are…well, lacking a few things. The examples don’t fully cover topics, which I guess is fine b/c as a developer one is always looking things up. Hello, professional Googler? Anyway…

Step 14’s hint is missing some info. It doesn’t hint that one needs to specify the column names that one is inserting the VALUES into. It should be this:

INSERT INTO manufacturers(name, id)
VALUES ('Pip-NNC Industrial', 11);

And, as for step 15…

One thing that’s helpful to do when writing SQL code is always do a spot check on the table if you’re updating it in any way. (Kind of like using print() to see how your code looks in Python or, running a df.head() in Pandas to see what the data frame looks like).

I would suggest before you’ve updated the manufacturers table in step 14, do a quick,

FROM manufacturers

Which will give you the previous ID values for those two companies:

Then you can do step 15.

UPDATE parts
SET manufacturer_id = 11
WHERE manufacturer_id IN (1, 2);

And then you can do another spot check:

FROM parts
WHERE manufacturer_id = 11;

Which gives you this:

I hope that makes sense…


Thank you very much for taking time to go through this.

I think I’m understanding it much better now.

So when we’re specifying this part…

UPDATE parts
SET manufacturer_id = 11
WHERE manufacturer_id IN (1, 2);

…we’re updating it so that wherever manufacturer_id has the IDs of 1 and 2, it’ll change and update to the ID of 11?

I guess we’re setting the WHERE IN values to 1 and 2 because Pip Industrial and NNC Manufacturing have now become the joined Pip-NNC Industrial which its ID is 11 and we want to update the individual manufacturers ID from 1 and 2 to the ID of this newly created joined manufacturer.

I do hope that I got it right. :sweat_smile:

1 Like

Yep, that’s correct.

It is a bit confusing b/c there are items that are missed in this mini project and things that aren’t covered prior to it.

One thing that I do when I don’t understand a question is, I re-write it or say it out loud in words that I understand and I draw out what I think it (code) will look like. Sometimes visualizing code prior to writing it is helpful. Also helpful is consulting the language’s documentation or another website if you don’t understand a function or operator b/c one doesn’t always find answers in only one place. You’ve gotta find an explanation that makes sense to you.

Lastly, because of this discussion here, this part of the FSE path is going to be reviewed and fixed. :slight_smile:

Happy coding!

1 Like