您的位置:首页 > 数据库 > Oracle

Oracle创建表和自增长主键

2012-07-09 09:36 239 查看
/*创建表 不带自动标示*/

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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: