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 trialGeoffrey Neal
30,298 PointsPRIMARY KEY returning null.
So I've specified the AUTO_INCREMENT and PRIMARY KEY keywords for the id column, and generally speaking it works as expected. However, when the id column reaches 250 (i.e. the last row) it adds one more row to each column with a value of null. It's not a major inconvenience but I thought a PRIMARY KEY automatically stops this from happening, at least in the id column. This still happens when I specify NOT NULL, any ideas??
1 Answer
Andrew McCormick
17,730 PointsWhen you say "it adds" what is the 'it' that you are speaking of? The tool that you are using? If this is in your tool, then is it only when you add it, not before you save it? A lot of tools will fill in the values with null while you add the values. However is a column cannot be null and you save it as null then it should error out.