Re: Normalized Tables & SELECT [was: Find "smallest common year"] - Mailing list pgsql-general

From Stefan Schwarzer
Subject Re: Normalized Tables & SELECT [was: Find "smallest common year"]
Date
Msg-id FE0D6DEC-DF04-4035-8803-F67411D52E39@grid.unep.ch
Whole thread Raw
In response to Re: Normalized Tables & SELECT [was: Find "smallest common year"]  (Alban Hertroys <a.hertroys@magproductions.nl>)
List pgsql-general
>
>
>>    - one table for the years names/ids/etc. (1970, 1; 1971, 2;
>> 1973, 3;
>> ....)
>
> If you _do_ need this table (because you want to constrain your
> statistical data to only contain a specific set of years, or
> because you
> need a quick list of available years to select from): Make the year
> primary key and drop the artificial index.
>
> Years are perfectly fine data to constrain on, and it saves you the
> joins with that table (the foreign key constraint constrains your data
> sufficiently).

If my years are not only single years such as 1970, 1971... but time
spans, such as 1970-75.... should your proposal be still valid? It
won't be anymore an integer field, but a text field instead...

Stef

pgsql-general by date:

Previous
From: Martin Marques
Date:
Subject: sha1 function
Next
From: Poul Møller Hansen
Date:
Subject: Dump of table structure is not consistent