pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Design of a database table
Date: Mon, 30 Jul 2018 10:18:10 -0500
Message-ID: <8da832f3-f1f6-2723-b755-ba54a6943e36@gmail.com> (raw)
In-Reply-To: <CAMsqVxuQXUDU2LkXz1u620GCQL1QZddjN_hSuv1_2KETX0jnJA@mail.gmail.com>
References: <CAMsqVxuQXUDU2LkXz1u620GCQL1QZddjN_hSuv1_2KETX0jnJA@mail.gmail.com>

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.




view thread (5+ messages)  latest in thread

Message-ID: <8da832f3-f1f6-2723-b755-ba54a6943e36@gmail.com>
Permalink:  ../8da832f3-f1f6-2723-b755-ba54a6943e36@gmail.com/
Also on:    postgresql.org/message-id/8da832f3-f1f6-2723-b755-ba54a6943e36@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Design of a database table
  In-Reply-To: <8da832f3-f1f6-2723-b755-ba54a6943e36@gmail.com>
  References: <CAMsqVxuQXUDU2LkXz1u620GCQL1QZddjN_hSuv1_2KETX0jnJA@mail.gmail.com> <8da832f3-f1f6-2723-b755-ba54a6943e36@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox