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 trialMUZ140264 Tsitsi Mupamombe
4,195 PointsHOW 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
MUZ141116 Tafadzwa Paza
12,893 PointsHie, 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.
Tod Novak
3,173 PointsIf you just want it to be the last column, try it without the "COLUMN" keyword. Everything else looks fine.
MUZ140264 Tsitsi Mupamombe
4,195 Pointsstill its not working
Tod Novak
3,173 PointsIs '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);
Tod Novak
3,173 PointsCan you query the table?
SELECT * FROM movies_table;
Ary de Oliveira
28,298 PointsDATABASE / 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;