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 trialgilroncharles
8,978 PointsMy answer doesn't pass. I've copied the command into mysql workbench and the table is created with no issues;
The command works fine in Mysql Workbench; i'm not sure if this is a bug or i need to format my script a little bit differently.
CREATE TABLE t_genres (pk_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, uk_name VARCHAR(45) NOT NULL);
Error Message: There's something wrong with the definition of your column named 'uk_name'. on some occasions if i make other adjustments i would also get an error that says pk_id does not have a primary key
2 Answers
Julian Aramburu
11,368 PointsI think you have to set your uk_name column to "UNIQUE KEY" as it says "...and a unique column called "uk_name" that can't be null...." so after your "NOT NULL" you need to add "UNIQUE KEY" also I think you could only add UNIQUE KEY as UNIQUE KEYS cant be null.
Hope it helps :D!
Cheers and Keep Coding!
Julian Aramburu
11,368 PointsHi mate! it would be helpful if you paste your code in order to check it!
Cheers!
gilroncharles
8,978 PointsCREATE TABLE t_genres (pk_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, uk_name VARCHAR(45) NOT NULL);
Error Message: There's something wrong with the definition of your column named 'uk_name'. on some occasions if i make other adjustments i would also get an error that says pk_id does not have a primary key
gilroncharles
8,978 Pointsgilroncharles
8,978 PointsThanks Julian! it worked in the code challenge, do you have any idea why it worked in MYSQL Workbench and not on Treehouse?
Julian Aramburu
11,368 PointsJulian Aramburu
11,368 Pointsit could be because you are asked to create an UNIQUE column... and you weren't creating one... It's going to work in your workbench because you are not forced to create anything specific