oracle sql自动递增
一、删除列
ALTER TABLE AA DROP COLUMN DEP;
适用于小表-----数据量小的时候;
2、ALTER TABLE AA SET UNUSED("DEP") CASCADE CONSTRAINTS;
然后在负载小的时候,删除
ALTER TABLE AA DROP UNUSED COLUMNS;
二、添加列
先加一新字段再赋值:
alter table table_name add mmm varchar2(10);
update table_name set mmm=** ;
三、设置字段值自动增加
insert into t_address (addressname) (select vcname from busstop)
create sequence seq_id_test_increment --序列
increment by 1 start with 1 maxvalue 9999999;
create or replace trigger insert_test_increment --触发器
before insert on t_address --t_address 表
referencing
new as new
old as old
for each row
begin
select seq_id_test_increment.nextval into :new.addressid from dual; --addressid字段
end;
相关文档:
SQLServer和Oracle的常用函数对比
1.绝对值
S:select abs(-1) value
O:select abs(-1) value from dual
2.取整(大)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.取整(小)
S:select floor(-1.001) value
O:select floor(-1.001) valu ......
1.选择最有效率的表名顺序(只在基于规则的优化器中有效)
SQLSERVER的解析器按照从右到左的顺序处理from子句中的表名,因此from子句中写在最后的表(基础表driving table)将被最先处理,在from子句中包含多个表的情况下,必须选择记录条数最少的表作为基础表,当SQLSERVER处理多个表时,会运用排序及合并的方式� ......
【转】http://www.gbunix.com/htmldata/2004_06/2/5/article_53_1.html
oracle系统表查询【GBUnix】
数据字典dict总是属于Oracle用户sys的。
1、用户:
select username from dba_users;
改口令
alter user spgroup identified by spgtest;
2、表空间:
select * fro ......
在ORACLE中给表、列增加注释以及读取注释
1、给表填加注释:SQL>comment on table 表名 is '表注释";
2、给列加注释:SQL>comment on column 表.列 is '列注释';
3、读取表注释:SQL>select * from user_tab_comments where comments is not null;
4、读取列注释:SQL>select * from user_col_commnents wh ......