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
Krystel Hagan
4,731 PointsKeys 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
Michael Mangan
9,164 Pointsthen add first to the end of the line like this.
alter table t_movies add pk_id int auto_increment primary key first
Calum McGloin
6,297 PointsALTER TABLE t_movies ADD COLUMN pk_id int AUTO_INCREMENT PRIMARY KEY FIRST
Michael Mangan
9,164 Pointsyou need a datatype:
ALTER TABLE t_movies ADD COLUMN pk_id int AUTO_INCREMENT PRIMARY KEY
Krystel Hagan
4,731 Pointsstill didnt work, its saying i need to use the FIRST command but i tried and it still isnt working
Adminsui Superw
1,553 PointsALTER TABLE t_movies ADD COLUMN pk_id INTEGER AUTO_INCREMENT PRIMARY KEY FIRST;