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 Data With SQL

Modifying Data with SQL Challenge question

Please can someone assist.

I am stuck on task 1 of 3: https://teamtreehouse.com/library/modifying-data-with-sql/adding-data-to-a-database/adding-data-with-sql

I have written the following code.

INSERT INTO products (id, name, description, price) 
VALUES 
(1, "Sarah", "Red", 10.99), 
(2, "Niamh", "Blue", 22.99), 
(3, "Elle", "green", 22.22), 
(4, "Brad", "purple", 10.22);

And it's giving the following error:

Bummer: Was expecting 4 entries in the products table. There's only 3.

3 Answers

Steven Parker
Steven Parker
231,269 Points

Here's a few hints:

  • the instructions only ask you to add one new product
  • they warn you that the ID column is auto-incrementing
  • an auto-increment column should be given a NULL value (or just not be included at all)

Thank you for your reply!

I have tried entering one product:

INSERT INTO products (id, name, description, price) 
VALUES 
("Sarah", "Red", 10.99);

It's still giving me the same error as above.

I've just realised I was including ID in both, when I didn't need it in either! Have fixed it, thank you!