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

PHP

Keys and Auto-Incrementing Values Task 2/3

Q: Alter the "t_movies" table to add an auto incrementing primary key called "pk_id" first.

A: ALTER TABLE t_movies ADD COLUMN pk_id AUTO_INCREMENT PRIMARY KEY

I am not sure what I am missing/doing wrong.

5 Answers

then add first to the end of the line like this.

alter table t_movies add pk_id int auto_increment primary key first

ALTER TABLE t_movies ADD COLUMN pk_id int AUTO_INCREMENT PRIMARY KEY FIRST

you need a datatype:

ALTER TABLE t_movies ADD COLUMN pk_id int AUTO_INCREMENT PRIMARY KEY

still didnt work, its saying i need to use the FIRST command but i tried and it still isnt working

ALTER TABLE t_movies ADD COLUMN pk_id INTEGER AUTO_INCREMENT PRIMARY KEY FIRST;