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

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,348 Points
INSERT INTO phone_book (first_name, last_name, phone) value ("fdf", "fdf", 4344342);

Removed ID and NULL.

2 Answers

Steven Parker
Steven Parker
222,348 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.