Why does theCategoryIDcolumn in thePicturestable have the Allow Null check box checked? What does it mean if a record in thePicturestable has a Null value for itsCategoryIDcolumn, and is this allowed with the foreign key constraint?
A1:
One of the design requirements for the system was that users could optionally place each picture in a category. This means that a given picture may be in a particular category or in no category at all. When a record in the Pictures table has a Null value for its CategoryID column, the picture does not belong to any category.
This is a common technique used when the records of the "many" table in a one-to-many relationship might not belong to any record in the "one" table. For this reason, Null values are allowed by the foreign key constraint.
Q2:
When a user uploads a picture, I want to capture additional information, such as whether the user wants this picture to be viewable by other users. Is it okay to add my own custom columns to thePicturestable?
A2:
If you are comfortable adding your own columns and have some data you want to capture that isn't being captured by my suggested data model, then feel free to add the additional columns. (Of course, you'll need to also add additional Web controls to the user interface for uploading a picture.)
What I recommend, however, is that you first complete the photo album application exactly as I'm doing it so that you can follow along in the book. Then, after creating and testing the application, return to the design phase and augment the requirements to include the additional information you are in interested in storing.