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 trialalvaro vasquez
1,011 PointsWe have an eCommerce database and it has a products table. It has the columns id, name, description and price...
confused...
6 Answers
Tim Abbott
14,206 PointsGreat thanks. Will do next time!
clarence hollins
2,301 PointsINSERT INTO products (name, description, price) Value ('t-shirt','white',2.99); I don't understand what is wrong with this code
Wynter Samuels
3,253 Pointsidk if you figured it out but you need to put a 's' after value
Melanie Fernandez
3,802 PointsTry this: INSERT INTO products(name, description, price) VALUES("banana","The best fruit",3.99);
Laurindo M Muginga
10,098 PointsTry using strings: INSERT INTO products (id, name, description, price) VALUES (NULL, "banana", "The best fruit ever", 1.99);
Violeta Last
14,547 PointsINSERT INTO products (id, name, description, price) VALUES (NOT NULL, "Value", "Value", 00.00)
Steven Parker
231,268 PointsThe rest of task 1 says, "Add a new product to the products table. Use any valid values you want. All columns are required. The id column is auto incrementing."
Since the ID column is auto incrementing, it can be left out. So you'll want to construct an INSERT statement that names the other 3 columns, and then supply VALUES for each of them. You can make up anything, it won't care as long as you supply all 3.
Give it a shot, and if you still have trouble post your code here for further assistance.
Tim Abbott
14,206 PointsHi Steve,
I don't see what's wrong with this?
INSERT INTO products (id, name, description, price) VALUES (NULL, Jeans, Blue, £70);
The Error Message says: Was expecting 4 entries in the products table. There's only 3. This suggests that the id with a NULL value is required? I've also tried it without the column names, thinking that may come next.
Thanks in advance....again! Tim
Steven Parker
231,268 PointsHi, Tim.
In future, please start a fresh new question to give others a chance to respond to it (plus the ability to vote on answers).
But literal string values (like 'Jeans') must be enclosed in quotes, and the "price" value should be just a number (no currency symbol). Give that a shot.