Re: Data Types

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: Data Types
Дата
Msg-id 20101105164740.GA5660@tux
обсуждение исходный текст
Ответ на Data Types  (ALT SHN <i.geografica@alt-shn.org>)
Список pgsql-novice
ALT SHN <i.geografica@alt-shn.org> wrote:

> Hello List,
>
> 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?

If i where you, maybe a text[]:

test=# create table Paleosites (species text[]);
CREATE TABLE
test=*# insert into Paleosites values (array['dinossauria','crocodilia','plantae']);
INSERT 0 1
test=*# select * from Paleosites;
             species
----------------------------------
 {dinossauria,crocodilia,plantae}
(1 Zeile)


Other solution: an extra table with a 1:m relationship.



Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Oliveiros d'Azevedo Cristina"
Дата:
Сообщение: Re: Data Types
Следующее
От: "Jean-Yves F. Barbier"
Дата:
Сообщение: Re: Data Types