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

HELP with SQL create table code challange database

Hey I have the following problem to solve : 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.

Here is my code :CREATE products(name VARCHAR(100) NOT NULL,stock_count INTEGER NULL ,description TEXT NOT NULL);

But it shows error and it didn't accept my work.I don't understand what is the mistake and problem here.Any help and explanation will be highly appreciated.

6 Answers

This did it for me:

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

Go back and start this question over, it seems to stick if you do it wrong, so you need to clear the page and rest the question.

Michael O'Malley
Michael O'Malley
4,293 Points

Switching up the ordered resolved the issue for me too. Found it a bit silly that if you follow the directions and do it in order -- it says you're incorrect.

Caroline Hagan
Caroline Hagan
12,612 Points

I tried this in phpMyAdmin and it worked ok...

CREATE TABLE  'mydatabase'.'products' (
'name' VARCHAR( 100 ) NOT NULL ,
'description' TEXT NOT NULL ,
'stock_count' INT NOT NULL
)
Brandon Biernat
Brandon Biernat
12,549 Points

Caroline - I tried your recommendation and it still didn't work for me. I am having the same troubles with this one. I put:

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

I can't seem to figure it out either.

+1

I cant figure this one out either! Any help?

thomas howard
thomas howard
17,572 Points

Look at Danny's answer. The problem with the question may come from how small the text is on the video. It's hard to follow. you have to plug in what is asked, but without seeing how it's done by having the video ready to go, or taking notes while the lesson is rolling, well. I had to come up here and figure it out. Thanks.