1.截取字符串 substring(字符串,起始位置,结束位置); 2.当前时间 now(); 例:select now(); 结果:2019-12-25 16:58:48.567233+08 3.时间按格式转换字符串 to_char(时间,'yyyy'); 例:select to_char ( now( ), 'yyyy' ); 结果:2019 4.时间的加减 now() - interval '2 d'; 例:select now() - interval '2 d'; 结果:2019-12-23 17:37:08.299901+08 4.判断是否存在某字符串 position('a' in 'hello'); 如果存在输出1,否则输出0. 例:select position('a' in 'hello'); 结果:0 5.如果为null则显示其他值 coalesce(null,1); 例:select coalesce(null,1); 结果:1
postgresql函数
最新推荐文章于 2024-07-12 10:47:52 发布