#where匹配多条记录
select vnfdname from nfpackage where nfpackageid in (select packageid from nfinst);
##修改表字段长度
alter table pkgnotify alter column swfiles type character varying(2048);
ALTER TABLE your_table_name alter COLUMN your_column_name type character varying(3000);
alter table vminst alter column vmid type character varying(3000);
#查看数据库是否只读状态:
show default_transaction_read_only;
#插入数据,通用于其他
insert into vminst (vmid,vimid,resourceid,insttype,instid,vmname,operationalstate,tenant,ispredefined) values('0afe682d-c0b9-4583-b1e9-da5907a485f2','NFV-RP-BJSYS-12A-ZX-VIM02','1817765a-4afa-4672-ab50-9eb9b7ee5940','0','40be5072-6831-11e9-b85a-1dd3d3033ac7','NRZ-ZX-12A-SV-1-VM-32-VM-STUC80002','0','ZTE_xGW_PROJ','0')
#选择并更新
update job_status set addtime=to_char(to_timestamp(addtime,'YYYY-MM-DD HH24:MI:SS')+ interval '1 D 1 hours 2 minutes','YYYY-MM-DD HH24:MI:SS') where jobid='VNF-terminate_vnf-24b68134-99de-42c8-ad98-bd309bb57e8c-e5801a48-5b46-11e9-a843-0242ac11000b';
# select 去重
select distinct serviceipaddress from portinst where instid='2' and serviceipaddress != '';
select distinct serviceipaddress from portinst where instid='2' and trim(serviceipaddress) != '';
select a.NFINSTID, a.NFNAME, a.NETYPE, b.*from NFINST a, NFINST_VNFM b where a.NFINSTID = b.NFINSTID and a.NFINSTID = '%s'
# psql select 比较时间
select count(collecttime) from cn_pm_collect_his where collecttime > '2020-03-02 02:00:00';