select extract(epoch from now());
select extract('epoch' from time_stop at time zone 'Europe/Warsaw')
as time_stop_timestamp from tabela
13 lut 2015
select extract(epoch from now());
select extract('epoch' from time_stop at time zone 'Europe/Warsaw')
as time_stop_timestamp from tabela
Zmiana typu pola integer na character varying w bazie postgresql:
ALTER TABLE ludzie ALTER COLUMN wiek TYPE character varying USING null
lub np. pola typu character varying na timestamp:
ALTER TABLE ludzie ALTER COLUMN data TYPE timestamp without time zone USING null
select
n_id,
substring(nazwa, '[^\-]*') as nazwa_pre
from nazwy n
where
n_status = 1
order by
nazwa
limit
150
Dane:
Adamowice-jezowka
Wynik:
Adamowice
select
*
from logs_2013
where
log_id = any(array [2911,2993,2097,5320,2599,1501,2113])
Grupowanie elmentów w array o zadanym rozmiarze 5 elementów
select
(array_agg(photo_id)) [1:5] as photo_ids
from photos