On 07/30/2018 09:37 AM, hmidi slim wrote:
I'm trying to design a database table. First of all there are two
alternatives:
1-) Divide the table into two tables and make a join.
2-) Design a single table.
1rst alternative:
Create table data_periods(
id serial primary key not null,
period daterange,
project_id integer
)
create table data_periods_info(
id serial primary key not null,
data_periods_id integer,
data_sub_periods daterange,
stock1 integer,
stock2 integer,
CONSTRAINT data_periods_allotment_id_fkey FOREIGN KEY (data_periods_id)
REFERENCES data_periods (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
Are you absolutely 100% positive that there will NEVER be more than two
stock numbers? (People say "yes" to this kind of question all the time and
then discover that they need more stock numbers when the business changes.)
--
Angular momentum makes the world go 'round.