postgreSQL 查询语句

select * from table where name in (select name from table2)     等效于    select * from table where exists (select name from table2) 

后者查询速度更快

clock_timestamp()  返回当前真实的时间

coalesce(nullif(rest,''),'0')  as new_rest    # 将rest字段的空值替换成0

select coalesce(nullif(rest,''),'0')  as new_rest from table

to_char(test_time,'YYYY/MM/DD')     # 转换成日期格式的字符串

to_timestamp(query_time,'YYYY/MM/DD HH24/MI/SS')   #  转换成日期

posted @ 2021-09-23 13:50  这世界我来过  阅读(310)  评论(0)    收藏  举报