Subject RE: [firebird-support] opinions on design
Author Nigel Weeks
> > Does anyone has some opinions about if this is a viable option for
> > design?
> >
> > Rick
>
> if the single table gets very large and you are selecting all
> the time by WHERE BOOLEANFIELD=1 then I would imagine the
> system suffering some performance issues.
> Alan
>

I'd lean towards designing it like this:

A central "Contact Details" table, containing thing like:
ID, Name, Address, City, Postal

Then, remote tables that store "Customer/Vendor/Employee" and
"Billto/Shipto" information

Example:
CREATE TABLE tbl_contact (
int_ID INT64 NOT NULL,
str_surname VARCHAR(50) NOT NULL,
str_names VARCHAR(100) NOT NULL,
str_phone VARCHAR(20),
str_email VARHCAR(40),
PRIMARY KEY(int_ID)
);

/* Vendor specific details that extend the tbl_contact */
CREATE TABLE xtbl_vendor (
int_ID INT64 NOT NULL, /* The Contact ID */
str_vphone VARCHAR(20),
str_vemail VARCHAR(40),
/* More Fields here... */
PRIMARY KEY(int_id)
);

/* Customer specific details that extend the tbl_contact */
CREATE TABLE xtbl_customer (
int_ID INT64 NOT NULL, /* The Contact ID */
str_cphone VARCHAR(20),
str_cemail VARCHAR(40),
/* More fields here... */
PRIMARY KEY(int_id)
);

With this approach, a left join from TBL_CONTACT to any extension table will
yield NULL is they're not a Vendor/Customer, etc.

...Might also be sub-optimal, but it's another approach!

Nige.