Re: Data Types - Mailing list pgsql-novice

From Andreas
Subject Re: Data Types
Date
Msg-id 4CD4DC33.6030809@gmx.net
Whole thread Raw
In response to Data Types  (ALT SHN <i.geografica@alt-shn.org>)
Responses Re: Data Types  (ALT SHN <i.geografica@alt-shn.org>)
List 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.



pgsql-novice by date:

Previous
From: Chris Browne
Date:
Subject: Re: COPY command and serial columns
Next
From: Vaduvoiu Tiberiu
Date:
Subject: Describe command alternatives in postgresql