Subject Re: [firebird-support] Conceptual question (about design)
Author Woody
From: "Sergio H. Gonzalez" <shg_sistemas@...>
>
> Hello there! I use Firebird 2.1, but this question is not specific to
> FB, I think
>
> Basically, I have a table with a field which can "point" to two tables
> (one or other, but *never* to both)
>
> What the experts says about this scenario?
>
> Option 1) is better to have a field which represent at what table I'm
> pointing and then the ID field... ?
>
> Option 2) or just two ID fields (FK to each table) and just leave null
> the field I not use...
>

I tend to think of future expansions so in most cases I go with option 1.
Having a field which defines the type of entry helps because it allows you
to expand options in the future in case other types of tables are needed.
Also, it allows all SQL and code to use the same field names without needing
separate logic to figure out which field to use.

In the future, questions like this should be posted to firebird-general
instead of the support group, just FYI.

Woody (TMW)