select time + INTERVAL '1 year' from test;
--postgressql时间相加
SELECT now() + INTERVAL '1 year 1 month 1 day 1 hour 1 min 1 sec'
--减一天
select * from test t1,test t2 where t1.time = t2.time - INTERVAL '1 day'
--加一天
select * from test t1,test t2 where t1.time = t2.time + INTERVAL '1 day'
--取绝对值
select abs(id) from test
select abs(-9)
字符串转整数:select cast('1234' as integer )
日期加减: SELECT now() + INTERVAL '1 year 1 month 1 day 1 hour 1 min 1 sec'
日期加减:SELECT now() :: TIMESTAMP - (列) :: INTERVAL
日期截取:SELECT date_trunc ('day', now())
数字截取:SELECT trunc(123.456, 2)
四舍五入:SELECT ROUND(125.56, 1)
进位取整:SELECT CEIL(125.56)
退位取整:SELECT FLOOR(125.56)
取年 select extract(year from now());
取月 select extract(month from now());
取日 select extract(day from now());
--字符串拼接
select 'Post' || 'greSQL'
https://www.cnblogs.com/orangeform/archive/2012/05/02/2294071.html