Oracle,SQL Server,MySQL的自增变量设置
2008-06-04 08:52
513 查看
Oracle,SQL Server,MySQL的自增变量设置:
1、MySQL的自增变量是比较好记的,使用AUTO_INCREMENT关键字,如果知道英文的就容易记忆了,如下创建一个带有自增变理的表:
create table test(id int AUTO_INCREMENT
primary key not null,name varchar(50));
注释:此处的id一定要申明为主键,否则会报错。
2、SQl Server使用identity关键字,可以很容易指定从什么数开始,增幅是多少,如下:
create table test(id int identity(100,10)
primary key not null,name varchar(50));
3、Oracle不能够在创建表的时候指定自动关键字,它需要重新创建sequence,然后以"创建键。nextval"来引用:
create table test(id int primary key
not null,name varchar(50));
create sequence test_id(最好是表名+序列号标记)
increment by 1 start with 1 maxvalue 9999;
引用如下:
insert into test(test_id.nextval,'www');
相关文章推荐
- Oracle,SQL Server,MySQL的自增变量设置
- Oracle,sqlserver,mysql的自增变量设置
- Oracle,sqlserver,mysql的自增变量设置
- Oracle,SQL,MySQL的自增变量设置
- Oracle,sqlserver,mysql的自增变量设置
- 数据库-Oracle【Oracle数据库设置默认表空间问题及Oracle,SQL,MySQL的自增变量设置】
- Oracle,sqlserver,mysql的自增变量设置
- Oracle、MySQL、SQL Server自增变量的方法
- oracle 默认表空间问题及自增变量设置
- mysql,sql server,Oracle主键自动增长的设置
- Oracle、MySQL、SQL Server自增变量的方法
- sql server ,mysql ,oracle 自增长字段设置以及自增长属性的修改验证
- Oracle、MySQL、SQL Server自增变量的方法
- 常用数据库的自增字段创建方法汇总_DB2_Oracle_MySQL_PostgreSQL_SQL Server_Sybase
- ORACLE环境变量设置
- oracle针对oracle和grid用户---环境变量设置---单实例和RAC
- 因未设置系统环境变量ORACLE_SID导致ORA-12162错误
- Java与SQL Server, MySql, Oracle, Access的连接方法以及一些异常解决
- oracle、mysql、sql server等;流行数据库的链接驱动配置
- 在SQL Server查询中设置变量初试