Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Modifying Data with SQL Adding Data to a Database Adding Data With SQL

Brenna Hyland
Brenna Hyland
1,774 Points

Hello! Confused by the following error: "Bummer: Was expecting 4 entries in the products table. There's only 3"

Hello!

I am unsure as to why I am receiving the following error message and have tried multiple ways of typing this out. I ran into a similar one in the immediately following problem (just for 11 vs 10 not 4 vs 3). What am I missing on this in terms of my code? How do I go about rectifying this?

Thank you!

4 Answers

Can you post your SQL? The error message you have received indicates no record was added to the products table. The table already contains 3 records and if successful your record would be the 4th.

Brenna Hyland
Brenna Hyland
1,774 Points

Thank you so much!

INSERT INTO products (id, name, description, price) VALUES (NULL, Tesla, car, 1000);

Where did I go wrong? Thanks!

You should assume name and description are text and as such their values should be enclosed in quotes.

 INSERT INTO products (id, name, description, price) VALUES (NULL, 'Tesla', 'car', 1000);

It needs to be single quotes (') too, not double-quotes(").

Brenna Hyland
Brenna Hyland
1,774 Points

Oh no! I feel so dumb. Thank you for your help! I was under the impression the addition of quotes was just for more than 1 word.

Thank you so much for your quick help!

Bruce Crighton
Bruce Crighton
1,253 Points

INSERT INTO products (id, name, description, price) VALUES (NULL,'green', 'crisps', 1.99);