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

SQL

Now we're using a database from a smartphone. It has a phone_book table. It has the columns id, first_name, last_name and phone. Add a new contact to the phone_book table. Use any valid values you want. All columns are required. The id column is auto incrementing.

INSERT INTO phone_book (id, first_name, last_name, phone) value (NULL, "fdf", "fdf", 4344342);

Bogdan Cabaj
Bogdan Cabaj
16,349 Points
INSERT INTO phone_book (first_name, last_name, phone) value ("fdf", "fdf", 4344342);

Removed ID and NULL.

2 Answers

Steven Parker
Steven Parker
231,248 Points

As Bogdan's example shows, an auto-increment column will be set for you, so you don't need to reference it at all when you insert a new row.

In future, please always provide a link the course page you are working with along with your code to enable the most complete and accurate analysis.

Terry Scrimsher
Terry Scrimsher
46,658 Points

Rostyk/Bogdan's example is missing an "s" at the end of "value", preventing it from running successfully.