Postgres – tabele

Tworzenie tabeli

CREATE TABLE users (
    id              serial  primary key,
    name            varchar(80),
    age             int,           -- how many years
    temp_hi         int,           -- high temperature
    prcp            real,          -- precipitation
    date            date
);
-- <komentarz>

DESC users – struktura tabeli users

\d+ users

Typy

int, smallint, real, double precision, char(N), varchar(N), date, time, timestamp, interval

Wstawianie danych – kopiowanie z pliku do tabeli

COPY users FROM '/home/joe/users.txt';