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

Development Tools

Ben Harrison
Ben Harrison
5,521 Points

Task Problem: Create a table called "products"

Create a table called "products" with a VARCHAR column named "name", a TEXT column named "description" and a INTEGER "stock_count" column. The name should be up to 100 characters long. Is the task, and this is my solution,

CREATE TABLE products (name VARCHAR(100) , description TEXT, stock_count INTEGER NULL );

I then get the error message: SQL Error: table products already exists

2 Answers

Thai Huynh
Thai Huynh
15,293 Points

Hi Ben try deleteing the table then re-creat it. So to delete it use: DROP TABLE products. Then run the create statement again.

Hi, Thai is right but may be use a conditional as a best practice. DROP TABLE IF EXISTS products. Cheers