using dummy row with NOT NULL to solve DEFAUT NULL

Posted by Tony38 on Stack Overflow See other posts from Stack Overflow or by Tony38
Published on 2010-12-24T21:48:31Z Indexed on 2010/12/24 21:54 UTC
Read the original article Hit count: 180

Filed under:
|

I know having DEFAULT NULLS is not a good practice but I have many optional lookup values which are FK in the system so to solve this issue here is what i am doing: I use NOT NULL for every FK / lookup valve field. I have the first row in every table which is PK id = 1 as a dummy row with just "none" in all the columns. this way I can use NOT NULL in my schema and if needed reference to the none row values which should be null.

Is this a good design or any other work arounds?

© Stack Overflow or respective owner

Related posts about database

Related posts about schema