1、交换两列值
update tableName set a=b,b=a
2、创建序列
create sequence 序列名
increment by 每次增加几
start with 开始数字
maxvalue 最大数字;
查询序列:select SEQUENCE_OWNER,SEQUENCE_NAME from dba_sequences where sequence_name like '%SEQ_%'
3、触发器
可以用navicat工具,设计表,触发器,定义中添加如下代码,并根据实际情况勾选:
begin
select 'EXP'|| lpad(SEQ_EXP_B.nextval,9,0) into :new.EXP_CD from dual;
end;
查询触发器:select SEQUENCE_OWNER,SEQUENCE_NAME from dba_sequences where sequence_name like '%SEQ_%'
4、查询数据库各表的数据量
select table_name,table_rows from tables
where TABLE_SCHEMA = '库名'
order by table_rows desc;