select czas, date_trunc(‘day’, czas)+’15:59:12′ as czas2 from czas limit 1;
UPDATE czas set czas = date_trunc(‘day’, czas)+’15:59:12′ WHERE wt_id = 3850;

„2008-11-07 15:58:37″;”2008-11-07 15:59:12″

select
  czas, date_trunc(‘day’, czas), date_trunc(‘day’, timestamp ’2010-08-11′)
from
  czas_t
where
  date_trunc(‘day’, czas) = date_trunc(‘day’, timestamp ’2010-08-11′)

„2010-08-11 07:37:46″;”2010-08-11 00:00:00″;”2010-08-11 00:00:00″
„2010-08-11 07:40:49″;”2010-08-11 00:00:00″;”2010-08-11 00:00:00″
„2010-08-11 08:04:42″;”2010-08-11 00:00:00″;”2010-08-11 00:00:00″
„2010-08-11 09:12:32″;”2010-08-11 00:00:00″;”2010-08-11 00:00:00″
„2010-08-11 08:55:52″;”2010-08-11 00:00:00″;”2010-08-11 00:00:00″
„2010-08-11 15:59:12″;”2010-08-11 00:00:00″;”2010-08-11 00:00:00″

 


delete from comments where comment SIMILAR TO '%(insurance|payments|health)%'usuwanie rekordów


select substring(n_text,1, 30) || substring(substring(n_text, 31, 15), '[^ ]*') || ' ...' as n_text from texts


UPDATE users SET pass = users2.pass FROM users2 WHERE users.id = users2.id;


select NOW()::date

„2010-04-23″

select t_date from table where t_date >= NOW()::date+’1 day’::interval order by t_date limit 3

„2010-04-24″
„2010-04-24″
„2010-04-24″

select t_date from table where t_date >= NOW()+’1 day’::interval order by t_date limit 3

„2010-04-25″
„2010-04-25″
„2010-04-25″


select t_add_date, SUBSTRING(t_add_date::character varying, 1, 19) from table where t_add_date < NOW()-'1 DAY'::interval
t_add_date substring
2010-03-10 21:26:49.928445 2010-03-10 21:26:49
2010-03-10 21:26:49.928445 2010-03-10 21:26:49


SELECT ROUND(liczba, 2) AS liczba1, ROUND(liczba, 4) AS liczba2 FROM tabela


select * from table where t_add_date < NOW()-’5 MONTH’::interval
select * from table where t_add_date < NOW()+’5 MONTH’::interval
select * from table where t_add_date < NOW()-’1 DAY’::interval
select * from table where t_add_date < NOW()-’2 DAYS’::interval

select * from table where t_add_date < NOW()-’1 DAY’::interval
select * from table where t_add_date < NOW()-’5 MINUTES’::interval

select * from table where t_add_date < NOW()-’3 HOURS’::interval


select mapa_pl, regexp_replace(mapa_pl, ‘!([a-z_]+)!’, E’<xsl:value-of select=”\\1″/>’, ‘g’) as test from mapy.mapa where mapa_pl like ‘%!%’

update mapy.mapa set mapa_pl = regexp_replace(mapa_pl, ‘!([a-z_]+)!’, E’<xsl:value-of select=”\\1″/>’, ‘g’) where mapa_pl like ‘%!%’

zamiana
mapa!id!
na
mapa<xsl:value-of select=”id”/>


(‘ul’, ‘Chełmska’, ’10′, ’10′)::ulica_obj

CREATE TYPE ulica_obj AS
(pre character varying,
ulica character varying,
d_nr character varying,
m_nr character varying);