Re: Design of a database table - Mailing list pgsql-general

From Ron
Subject Re: Design of a database table
Date
Msg-id 8da832f3-f1f6-2723-b755-ba54a6943e36@gmail.com
Whole thread Raw
In response to Design of a database table  (hmidi slim <hmidi.slim2@gmail.com>)
List pgsql-general
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.


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: Restore relhaspkey in PostgreSQL Version 11 Beta
Next
From: Didier Wiroth
Date:
Subject: jndi jdbc url with ssl authenticat in tomcat ... failsorg.xml.sax.SAXParseException columnNumber: 79; The reference to entity "ssl"must end with the ';' delimiter