
Postgres
tumenooe
这个作者很懒,什么都没留下…
展开
-
PG排序null值问题
null排在有值的行前面还是后面通过语法来指定--null值在前select * from tablename order by id nulls first; --null值在后select * from tablename order by id nulls last; --null在前配合desc使用select * from tablename order by id desc nulls first; --null在后配合desc使用select * from t转载 2021-04-14 17:04:35 · 1403 阅读 · 0 评论 -
PG修改/删除/添加主键(复合主键)约束
#1. 删除主键约束ALTER TABLE "table_name" DROP CONSTRAINT "table_name_pkey";#2. 增加主键约束ALTER TABLE "table_name" add primary key (xx,xx,xx);原创 2021-03-23 10:13:37 · 13227 阅读 · 1 评论 -
PG给某个字段增加/删除非空约束
1. 删除非空约束alter table xxx alter xxx drop not null;2. 添加非空约束alter table xxx alter xxx set not null;原创 2020-08-11 17:36:45 · 9072 阅读 · 0 评论