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

Databases

Nikola Jovanovic
Nikola Jovanovic
7,278 Points

I am getting an SQL error, no such table rocks, and i am not sure why?

I think i have type the code well, but for some reason i am getting an SQL error, there is no table ROCKS!? Somebody advice please.

Nikola Jovanovic
Nikola Jovanovic
7,278 Points

Here is my code: CREATE TABLE IF NOT EXISTS ROCKS ( ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME VARCHAR(255), TYPE VARCHAR(255), COLOR VARCHAR(255) );

4 Answers

Steven Parker
Steven Parker
231,128 Points

Okay, here's the scoop. This challenge works when you omit column datatypes in a CREATE. None of the databases I use professionally allow this, but SQLite does. 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.

Steven Parker
Steven Parker
231,128 Points

I get a different error ("Bummer! SQL Error: PRIMARY KEY must be unique"), but I was also unable to pass with other solutions that I thought should work. It looks like you may have discovered a bug missed by QA.

Submit a bug report to the staff as described on the Support page. If you're the first, you should get an :beetle: Eliminator badge!

Nikola Jovanovic
Nikola Jovanovic
7,278 Points

Thank you for pointing that out. Will do that, in the end i just want this to be solved...

Nikola Jovanovic
Nikola Jovanovic
7,278 Points

Thank you Steven, when I excluded the column datatypes it passed without errors. You were really helpful.