oracle 插入表 自动增长 举例说明

上一篇 / 下一篇  2013-10-10 15:55:26 / 个人分类:数据库


create database Tests--创建database
go

create sequence stuid_seq increment by 1;--创建自动增长

create table Students--创建表
(
 stu_id int  primary key,
 stu_name varchar(50) not null,
 stu_age int not null
)


go
insert into Students values(stuid_seq.nextval,'a',1);--向表中插入字段,注意自动增长列的插入
insert into Students values(stuid_seq.nextval,'b',1);
insert into Students values(stuid_seq.nextval,'c',2);
insert into Students values(stuid_seq.nextval,'d',2);
insert into Students values(stuid_seq.nextval,'e',3);

select * from students;


TAG:

 

评分:0

我来说两句

Open Toolbar