Subject | Re: [firebird-support] very basic questions about FK |
---|---|
Author | Martijn Tonies |
Post date | 2009-10-14T14:08:14Z |
Hello Sergio,
Why do you not go with the NULLs?
With regards,
Martijn Tonies
Upscene Productions
http://www.upscene.com
Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!
Database questions? Check the forum:
http://www.databasedevelopmentforum.com
> Hello, I'd like to know if this is a "good practice"... In some tables INo.
> have a
> some IDs that could be "with no value" but in most of the cases they have
> values
> pointing to other tables. I still define the IDs as not null and create
> foreign
> keys and use negative values (-999, for instance) and create a "system
> record"
> (id = -999) which means "no value" and have triggers that would prevent
> any user
> to delete a record with an ID < 0, raising an exeception like "this is a
> system
> record, can't be deleted"
>
> Is this ok?
>or is better, in that cases, not to use a foreign key and let theCertainly.
> field be null ?
Why do you not go with the NULLs?
With regards,
Martijn Tonies
Upscene Productions
http://www.upscene.com
Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!
Database questions? Check the forum:
http://www.databasedevelopmentforum.com