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 Manipulating Schema with SQL Adding Columns

HOW DO I ADD COLUMN

ADD A COLUMN TO THE MOVIES TABLE CALLED 'GENRE' AND IS OF TYPE VARCHAR UP TO 25 CHARACTERS IN LENGTH

MY COMMAND IS

ALTER TABLE movies_table ADD COLUMN genre VARCHAR(25);

5 Answers

Hie, Tsitsi the syntax looks okay but on the challenge the name of the table is "movies" and not "movies_table" or "movies table" so you need to write it as:

ALTER TABLE movies ADD COLUMN genre VARCHAR(25);

and you will pass the challenge just fine.

If you just want it to be the last column, try it without the "COLUMN" keyword. Everything else looks fine.

still its not working

Is 'movies_table' the actual name of the table? What you have above is the correct syntax to add a column (without the word 'COLUMN').

ALTER TABLE 'table_name' ADD 'column_name' VARCHAR(25);

Can you query the table?

SELECT * FROM movies_table;

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;