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

Development Tools

Database Foundations - Add & Alter Table Column Change

I am stuck on Challenge question # 2 for Adding Columns Database Foundations.

Question: In one statement, in the movies table rename the year to release_year and change the type to the type of YEAR.

Code: ALTER TABLE movies CHANGE COLUMN year release_year, type type of the YEAR;

Response: Bummer! The column of 'release_year' of type YEAR is missing. SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' type type of the YEAR' at line 1

5 Answers

Marcin Robert Kaźmierczak
Marcin Robert Kaźmierczak
33,570 Points

Juan, you have an error in this SQL, you should change year_release to release_year.

Final solution is:

ALTER TABLE movies CHANGE COLUMN year release_year YEAR;

Juan,

Thank you, I finally got it. YEAR is the key at the end of the code.

DATABASE / MySQL

Challenge Task 1 of 3

Add a column to the movies table called 'genre' and is of type VARCHAR up to 25 characters in length.

ALTER TABLE movies ADD COLUMN genre VARCHAR(25);

Challenge Task 2 of 3

In one statement, in the movies table rename the year to release_year and change the type to the type of YEAR.

ALTER TABLE movies CHANGE COLUMN year release_year Year;

Challenge Task 3 of 3

Remove the place_of_birth column from the 'actors' table.

ALTER TABLE actors DROP COLUMN place_of_birth;

The correct answer is:

"ALTER TABLE movies CHANGE COLUMN year release_year YEAR;"

Hopefully, this helps you

There's no type type of the YEAR, you should use some sort of date type. I don't know exactly what the code is but in terms of mysql should it be something like:

ALTER TABLE movies CHANGE COLUMN year year_release date;

or so. I hope it helps, good luck!