pgsql:插入数据,存在就更新,不存在就插入
插入数据,存在就更新,不存在就插入
insert into tablename (key1,key2,key3) values ('xxx','xxx','xxx') on conflict(key1) do update set key2 = 'yyy',key3 = 'yyy';
修改表中的字段值(修改key1的值)
update tablename set key1 = '' where ...;
修改表中的字段名(将key1修改为key2)
alter table tablename rename key1 to key2;
表中新增字段
alter table tablename add key1 character varying not null;
修改表名
alter table "tablename" rename to "new_tablename";
删除表中某个字段
alter table tablename drop column if exists key1;