Re: Design of a database table

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Design of a database table
Date: 2018-07-30 15:18:10
Message-ID: 8da832f3-f1f6-2723-b755-ba54a6943e36@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Didier Wiroth 2018-07-30 15:32:10 jndi jdbc url with ssl authenticat in tomcat ... fails org.xml.sax.SAXParseException columnNumber: 79; The reference to entity "ssl" must end with the ';' delimiter
Previous Message Melvin Davidson 2018-07-30 14:42:49 Re: Restore relhaspkey in PostgreSQL Version 11 Beta