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

Development Tools

Spencer O'Neill
Spencer O'Neill
9,384 Points

SQL - VALUES vs SET

For the first challenge in Inserting, Updating and Deleting, we are asked to insert "Aliens" and 1986 into a new row in movies.

I initially was trying to use INSERT INTO movies SET title="Aliens", year = 1986 but was puzzled that this was incorrect.

I then went through the lines of code from following the video, and was reminded of the keyword VALUES. My question, and source of confusion, is why these two things aren't equivalent.

Thanks!

1 Answer

Here is the full explanation for your confusion (http://stackoverflow.com/questions/861722/mysql-insert-into-table-values-vs-insert-into-table-set)

In short, use

INSERT INTO table (a, b, c) VALUES (1,2,3) 

because it is SQL standard.