Subject | "best way" of doing a very simple thing (or is "expensive" having fields with nulls?) |
---|---|
Author | Sergio H. Gonzalez |
Post date | 2013-11-18T23:43:18Z |
(FB2.5)
Hello!
I have a simple table like this
CREATE TABLE INVOICES_DETAIL (
ID ID,
ID_STOCK FK_ID,
QTY INTEGER,
PRICE MONEY,
DEFAULT_PRICE MONEY
);
Most of the times, (lets say 90%) the default_price is null.
It makes sence to use a field for that value?
Or is better having an extra table and just add a record when the price
is not null and then selecting the data with a left join to the secondary
table?
I hope I'm clear!!!
Thanks!!
Sergio
Hello!
I have a simple table like this
CREATE TABLE INVOICES_DETAIL (
ID ID,
ID_STOCK FK_ID,
QTY INTEGER,
PRICE MONEY,
DEFAULT_PRICE MONEY
);
Most of the times, (lets say 90%) the default_price is null.
It makes sence to use a field for that value?
Or is better having an extra table and just add a record when the price
is not null and then selecting the data with a left join to the secondary
table?
I hope I'm clear!!!
Thanks!!
Sergio