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 trialJuan Bolanos
12,492 PointsCreating and Modifying Database Tables - Challenge 1 of 3
Am I an idiot or something? I can't figure out the correct answer to this question... 'In the last challenge we created a table for the members of our rock collecting club. Now, we'd like to add a ROCKS table to store information about our favorite rocks. Can you create a table named ROCKS with the following columns: ID, NAME, TYPE, COLOR. And make sure that ID is a primary key.
'I have tried multiple queries and for some reason neither work. What am I missing, am I blind?
Here are the queries I've tried: CREATE TABLE ROCKS(ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME VARCHAR(255), TYPE VARCHAR(255), COLOR VARCHAR(255));
CREATE TABLE ROCKS(ID INTEGER PRIMARY KEY, NAME VARCHAR(255), TYPE VARCHAR(255), COLOR VARCHAR(255));
CREATE TABLE ROCKS(ID PRIMARY KEY , NAME VARCHAR(255), TYPE VARCHAR(255), COLOR VARCHAR(255));
4 Answers
Ben Deitch
Treehouse TeacherRest assured you are not an idiot! There was a problem with the CC that should be fixed now. Let me know if it's not, and thanks for pointing this out!
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,350 PointsHere is a hack to get you through the challenge. Let me know if it works for you.
create table rocks(id primary key, name, type, color);
Mary Urban
6,321 PointsI used exactly the hack listed above by Dale Severude and it didn't work in the challenge, but it worked in the playground just fine.
Steven Parker
231,236 PointsOkay, here's the scoop. This challenge works when you omit column datatypes in a CREATE. SQLite doesn't actually use datatypes, which was covered in the first video of this course. But it normally treats them as a notation and does not cause an error.
I still think it's a bug in the course, particularly since it worked in earlier challenges to supply the datatypes, but you can get around it here by leaving them off.
You also don't need the "autoincrement", and be sure to enter the column names just like they were given: in lower case.
Juan Bolanos
12,492 PointsAre we to assume that we should be writing as if using SQLlite and not MySQL or are both similar?
Ben Deitch
Treehouse TeacherThey're fairly similar, but we're looking for SQLite in the challenges.
Juan Bolanos
12,492 PointsJuan Bolanos
12,492 PointsThat’s funny because I first inquired about the question to staff, Kara, about what I thought was a big. This was after spending time trying different answer and searching the forums, and finding posts about it being a bug. I was told that it wasn’t a big and that I put in the wrong answer. Surprise it was a big lol. The original answer now works.
I feel a lot better now knowing I’m not an idiot haha.
Daniele Fusari
40,669 PointsDaniele Fusari
40,669 PointsHI BEN, I think this might not be working again?
Bummer SQL Error: UNIQUE constraint failed: ROCKS.ID
Ben Deitch
Treehouse TeacherBen Deitch
Treehouse TeacherWell that IS a bummer. Either way, it should be fixed now!
Daniele Fusari
40,669 PointsDaniele Fusari
40,669 PointsThanks Ben. Realy enjoyed your course.