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

C#

problem with modifying data with sql - question about the challenge 3 of 3 where you have to insert a new contact

hallenge Task 3 of 3

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.

I am not able to get my answer to work. Any suggestions?

4 Answers

Kallil Belmonte
Kallil Belmonte
35,561 Points

Hi Amy, you are forgetting the quotation marks around the values, try this:

INSERT INTO phone_book (id, first_name, last_name, phone) VALUES ( '10', 'Ray', 'Riley', '345-3345');

This code worked for me,i don't see a need to include id since its auto incremented .

INSERT INTO phone_book (first_name, last_name, phone) VALUES ( 'Prince', 'Mandaza', '423-4567');

Thank you Kallil Belmonte

Here is my code I tried

INSERT INTO phone_book (id, first_name, last_name, phone) VALUES ( NULL, Ray, Riley, "345-3345");