what do i mean by "in general"?
you know that primary keys must be declared NOT NULL, right?
okay, so all non-PK columns can be NULL
any table, anybody's database, anytime, anywhere...
in general
okay, now for the exceptions --
if you absolutely positively gotta have a value in a column, declare it NOT NULL
otherwise, leave it NULL
that way, you can do stuff like
Code:
insert
into myhumungoustable
( myPK
, column23
, column52
)
values
( 937
, 'foo'
, 'bar'
)
and you can be assured that the row will insert regardless of the fact that the other columns in the table have missing values
yes, you could have a whole whack of DEFAULT values, so that nothing actually ends up being NULL
but that's not the point
the point is, you don't want to have to supply default values in the INSERT statement, and you don't even want to look up the table layout to figure out whether the other col;umns have DEFAULT values or not -- all you want to do is create the row with whatever data you do have
and now, let's address your key point:
Frankly, working with UI developers, I don't want to give them the opportunity to decide which fields are and are not required. If all non-key columns are NULLable, then they can effectively pick and choose which ones they will require.
where is the database designer in this scenario?
the database designer should tell the developers which columns are NOT NULL
the developers should not get the opportunity to decide at all
but what is NULL or NOT NULL based on?
it is
most certainly NOT based on an arbitrary guideline like "make all your columns not null except end dates"
that's just silly
it is based on whether the column must always have a value
according to the business rules of the application
this is established in the database design phase
in general, identity is required, attributes are optional
thus, PKs are NOT NULL, non-key columns are NULL
in general
rudy
SQL Consulting