pgsql常用命令
导入csv文件
copy public.test(oid,title, shijian, uid) from 'D:/test.csv' csv header;
查询结果更新到表
UPDATE public.userm SET (cardno)=(select "SFZ" from tst_sys_user where tst_sys_user."USERNAME"=userm.name limit 1) WHERE uid>2064
自增ID与实际ID不统一
Select setval('kecheng_id_seq', 1334)
修改密码
ALTER USER postgres WITH PASSWORD '123456';
查询结果插入到表
insert into res (title, url) (select title, url from res_o where id=1092 order by id)
强制转大写 upper/小写 lower
UPDATE public.userm
SET pwd=upper(pwd)
WHERE uid>0
修改数据类型
ALTER TABLE jifen ALTER COLUMN shijian
TYPE TIMESTAMP USING to_date(shijian, 'DD/MM/YYYY HH24:MI:SS')::date;