Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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?

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


pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group