Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Code challenge: inserting, updating and deleting

The second objective:

Update the film alien to have the year 1979.

I don't know why this doesn't work:

Update movies set year=1979 where title=1979

Please help.


8 Answers

I think your query should be: UPDATE movies set year = 1979 WHERE title='Alien';

Alban, I just used this command on the quiz and it worked for me

update movies set year = 1979 where title = 'Alien';

Thanks for your answer Lee.

I just registered yesterday and I'm observing some strange behavior on the platform from my computer. Yesterday I wasn't able to check the answers on code challenge because of communication errors, and earlier I swear I typed the exact same statement you indicated and it didn't worked and I just retried right now and now it's working .....
My computer is huanted or something ! ;)

thank you for your answer though CHeers A.

I'm glad it's working for you now Alban.

I'm unearthing this post because for me this statement give me an error : UPDATE movies SET year = 1979 WHERE title="Alien"; return > Couldn't find the movie with the title 'Alien' in the year 1979 (which doesn't make sense considering my request)

And I don't get why .

I'm using the exact same statement on my local MySql server and it succeed.


Alban Hi I would like to ask a question, you are still having trouble with your computer. I read your testimony speaking up about your computer's behavio?

Clayton, the only issue with that is Aliens is not the same movie as Alien ;)

Clayton Perszyk
Clayton Perszyk
Treehouse Moderator 48,723 Points

I was under the impression that the second question was updating and replacing the data from the first question; but now I see that it was independent of the first question and updating different data. Thanks for the response, you're definitely right. I removed my comment so it doesn't confuse anyone.

Challenge Task 1 of 3

Insert a new row into the movies table where the title is the string 'Aliens' and the year is an integer 1986.

INSERT INTO movies (title, year) VALUES ("Aliens", 1986);

Challenge Task 2 of 3

Update the film 'Alien' to have the year 1979.

update movies set year = 1979 where title = 'Alien';

Challenge Task 3 of 3

Remove all movies from the year 1985 from the movies table.

DELETE FROM movies WHERE year = "1985";

You might need to encapsulate your values in ' ' or " ". Also you might want to check the movie title ;)

darius goore
darius goore
3,803 Points

The following is not working for me: UPDATE movies SET year=1979 WHERE name='Alien';


darius goore
darius goore
3,803 Points

Silly mistake. Thanks!