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 Altering Columns

What if you wanted to just change the column type, and not the name as well?

would you just use

This being table name. This being column name. l l V V ALTER TABLE .....CHANGE COLUMN.....YEAR;

PS I know I did not have to use the keyword "COLUMN".

So you just wouldn't use the old column type, just add the new one, with the column name?

3 Answers

CHANGE allows you change both the column name and type in one (as per below). MODIFY makes more sense if you just need to change the type.

ALTER TABLE tablename CHANGE columnname newcolumnname INTEGER;

OOOhhhhhHHHhhhHHhhhhh...IIii gotcha. THANK you. that is VARY important! I wish they said that in the video!

ALTER TABLE tablename MODIFY columnname INTEGER;

so CHANGE is only for what then, only changing column names and not column types?

No prob, Send them a suggestion so that the next poor fella isn't left scratching his head!!

haha oh they know me QUITE to well lol, and I shall!