
postgre-sql
jy352
欢迎互相关注!
展开
-
pgsql查询统计每天的数据
因为最近一直在使用pg数据库,然后遇到一个问题是需要统计每天的数据。表里有一个字段是记录的创建时间,但是类型却是timestamp类型,不能直接用group by之类的语句来解决问题。经过一番努力,终于找到解决方案,语句如下:select count(1),substring(to_char(t.created_date,'yyyy-MM-dd hh24:MI:ss') from 1 to 10)原创 2017-09-21 21:51:02 · 11273 阅读 · 0 评论 -
postgresql重命名索引
索引重命名:alter index if exists old_name rename to new_index_name;约束重命名:alter table name rename constraint constraint_name to new_constraint_name;原创 2018-06-06 23:30:25 · 5466 阅读 · 2 评论