Re: Data Types

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Data Types
Date: 2010-11-06 04:40:19
Message-ID: 4CD4DC33.6030809@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Am 05.11.2010 16:17, schrieb ALT SHN:
> I have a column of a table of paleontological sites named "Paleosites"
> wich has a column named "species". A paleosite can contain remais of
> one or more animals. So in that column sometimes I have to put this:
> dinossauria crocodilia plantae. This indicates that from a given
> paleosite were retrieved the remais of 3 different species.
>
> Now my question is: wich data type should the column "Species" be?
> Text? Varchar?

None.
Do it with 3 tables and use numerical representation of your keywords as
Jean-Yves described.
The technique is called foreign key and normalisation.
This might sound complicated at first but it is much better than writing
everything in a textfield.

As soon as you have a certain amount of data in your database, you will
have to cope with "dynosauria" and "krocodillia". Typing errors will happen.

Please find some time to get a better idea what a relational database is
all about.
Really this will help you a lot.
And you should be prepared to do the whole work again when you learnd
some basics. ;)

BTW you might be interested to know that PostgreSQL has datatypes and an
addon for geolocations.
You will want to store GPS coordinates for the sites.
I'm sure some others here have allready used this feature. I just saw it
somewhere mentioned.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Vaduvoiu Tiberiu 2010-11-06 09:37:10 Describe command alternatives in postgresql
Previous Message Chris Browne 2010-11-05 21:25:58 Re: COPY command and serial columns