Oracle创建表和自增长主键
2012-07-09 09:36
337 查看
/*创建表 不带自动标示*/
create table product
(
pid number(15) primary key not null,
pname varchar2(20) not null
);
commit;
insert into product(pid,pname) values(1,'美瞳');
commit;
/*清楚表记录*/
truncate table product;
commit;
select * from Product;
/*查看表结构*/
desc product
drop table orders;
/*创建表 带自动标示*/
create table orders
(
oid number(15) primary key not null,
pname varchar2(50) not null
);
create sequence oid_id start with 001001 cache 2;/*创建自动标示序列*/
insert into orders(oid,pname) values(oid_id.nextval,'美瞳');
commit;
create table product
(
pid number(15) primary key not null,
pname varchar2(20) not null
);
commit;
insert into product(pid,pname) values(1,'美瞳');
commit;
/*清楚表记录*/
truncate table product;
commit;
select * from Product;
/*查看表结构*/
desc product
drop table orders;
/*创建表 带自动标示*/
create table orders
(
oid number(15) primary key not null,
pname varchar2(50) not null
);
create sequence oid_id start with 001001 cache 2;/*创建自动标示序列*/
insert into orders(oid,pname) values(oid_id.nextval,'美瞳');
commit;
相关文章推荐
- oracle中创建表主键id依据sequence自增长
- oracle(01): 创建表,主键自增长,注解,视图,序列
- oracle创建表,追加备注,添加主键,触发器,自动增长序列
- <四>Oracle创建sequence序列,实现主键自增长
- Oracle使用序列创建自增字段(主键自动增长)
- oracle中创建表主键id依据sequence自增长
- Oracle学习:表的创建与主键自增长
- 笔记 oracle 创建主键自增长
- Oracle创建自增长主键
- oracle 创建表sql语句,主键,自增长
- oracle创建表并添加主键,设置主键自增长
- oracle 创建表sql语句,主键,自增长
- oracle创建自增长主键
- powerdesigner创建oracle 数据库表,设置表主键列为自动增长
- oracle创建主键自增长
- powerdesigner创建oracle 数据库表,设置表主键列为自动增长。 .
- 『PLSQL』在oracle表中怎样创建自增长字段?
- Oracle 创建主键自增表
- 为实现表的主键自增长,创建序列和触发器
- Oracle创建表(包含、主键自增)