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
Columns that are able to have null values
I wonder there are any rules on what kind of column should have a value present or can have NULL value. Is it database designers that can control over it when they create database or there are specific type of values we need to know to distinguish those two different kinds?
Steven Parker229,005 Points
The decision to allow NULL or not is part of the design. Any column that serves as an index, identifier, or provides a foreign key for relationships will be designed to not allow NULL values.
Otherwise, it becomes a decision based on what makes sense for the kind of data being stored in the column. A table of poll responses, for example, might use NULL to represent "no answer" to a question.