Subject Re: [firebird-support] very basic questions about FK
Author Martijn Tonies
Hello Sergio,

> Hello, I'd like to know if this is a "good practice"... In some tables I
> 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?

No.

>or is better, in that cases, not to use a foreign key and let the
> field be null ?

Certainly.

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