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


SQL Error: Unique Constraint Failed...but I haven't entered any values

I'm in the Creating and Modifying Database Tables course working on this challenge:

We're starting a rock collectors club! Can you create a 'members' table with the following columns: id, first_name, last_name, and favorite_rock. Also, make sure we only allow unique ids.

I'm entering:


ID SMALLINT primary key,

first_name VARCHAR(255),

last_name VARCHAR(255),

favorite_rock VARCHAR(255)


...and I get the error "SQL Error: UNIQUE constraint failed: MEMBERS.ID" A thread in StackOverflow is telling me that this is happening because I'm entering duplicate values in the primary key column, but I haven't entered any values. What's going on here?

1 Answer

Sorry! I did a better search and I see that this question is malfunctioning. I'll send to Support.