Databasen - NULL dates

Dominic Mitchell dom at happygiraffe.net
Wed Oct 18 13:00:35 BST 2006


On Wed, Oct 18, 2006 at 01:04:38PM +0200, Hakim Cassimally wrote:
> On 18/10/06, Neil de Carteret <n3dst4 at gmail.com> wrote:
> >> Anyone think of any other alternatives to using NULL?
> >
> >I wouldn't advocate it, but a second table, the PK of which FKs the
> >first table.  Then you can do a COUNT() to see if there's a date set
> >for an entity.  Or a LEFT JOIN, in which case you still get NULLs
> >returned but at least you're not storing them in the database.
> 
> I read a "NULL is evil!" paper that suggested having exactly such a
> table with the dates (if they existed) linked to the main table.  And
> then another table containing the ids of records that *didn't* contain
> a date.

That reminds me of this little gem:

  http://thedailywtf.com/forums/thread/93226.aspx ("Journey to the Center of the Database")

> Er, yeah, I'd just use NULLS :-)

Aye.

-Dom


More information about the london.pm mailing list