Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Kieran Gibbons
Kieran Gibbons
17,434 Points

Database Foundations issue

I'm having trouble figuring out the following question in Database Foundations. Can anyone point me in the right direction please?

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, release_year type int YEAR;

1 Answer

Placid Rodrigues
Placid Rodrigues
12,630 Points


Same syntax is used for changing column name and column data-type.

Suppose, in person table, there is a column named first_name of data-type VARCHAR(60). If you want to change the column name to f_name but not the data-type, you still need to declare the original data-type in your SQL statement. LIke this:

ALTER TABLE person CHANGE COLUMN first_name f_name VARCHAR(60);

If you want to change a data-type of the column, you will use the same syntax. In this case the original column name and new column name will be same and the data-type will be changed. Like this:

ALTER TABLE person CHANGE COLUMN first_name first_name TEXT;

So, as shown in the video, you change both the column-name (from year to release_year) and data-type (from INT to YEAR) in the following way:

ALTER TABLE movies CHANGE COLUMN year release_year YEAR;

Hope that helps,