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 Modifying Data with SQL Adding Data to a Database Adding Multiple Rows to a Table

Tony Lawrence
Tony Lawrence
3,056 Points

Trouble with Running SQL in Workspace.

Hi,

I'm having trouble with my workspace when following the steps as in the video to build up some muscle memory. However, when I run the script I get an error like this: Error: UNIQUE constraint failed: books.title. I notice in the table that I insert that the information has already been inserted. Is this problem occurring because that specified information is already in there? (I doubt that since the new command would just overwrite the information.)

Thanks

1 Answer

Little late i know, but what is happening is you are trying to add the same data twice. So it comes back with an error. It wont return a query when inserting data so you probably didnt notice it, but the data was added. Assuming that nothing happened, like i did lol, you press it again and this time it returns the error saying that the data can not be added because it is not UNIQUE.