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 trialGregory Ledger
6,116 PointsInserting rows in a table
Noticed that the NULL value was not used in writing the INSERT INTO statement in the adding multiple rows video, while it was used in the previous video. Is the NULL statement really necessary in an auto increment column?
1 Answer
Steven Parker
231,248 PointsThe default value for a column not explicitly inserted is normally NULL.
So you can usually omit a column entirely in an INSERT statement if your intention is to give it a NULL value (or whatever the default is for the column).
Since auto-increment columns always get a computed value it is common to omit them in an INSERT statement.