-----------创建表空间
create tablespace auctionDB
datafile ‘E:\OracleDB\System_TableSpace\auctionDB.dbf‘
size 10M
Autoextend on
------------删除表空间
drop Tablespace auction
------------删除约束
alter table auctionRecord
drop constraint FK_rec_REF_user;
------------创建约束
create unique index Index_1 on auctionUser (
userName ASC
);
------------删除索引
drop index Index_1;
------------删除表信息
drop table auction cascade constraints;
------------创建表
create table auction (
auctionId number(6) not null,
auctionName nvarchar2(50) not null,
auctionStartPrice number(9,2) not null,
auctionUpset number(9,2) not null,
auctionStartTime TIMESTAMP not null,
auctionEndTime TIMESTAMP not null,
auctionPic BLOB not null,
auctionPicType nvarchar2(20) not null,
auctionDesc nvarchar2(500),
constraint PK_AUCTION primary key (auctionId)
)tablespace auctionDB;
create table auctionRecord (
id number(9) not null,
userId number(6),
auctionId number(6) not null,
auctionTime TIMESTAMP default SYSDATE not null,
auctionPrice number(9,2) not null,
constraint PK_AUCTIONRECORD primary key (id),
constraint FK_rec_REF_user foreign key (userId)
references auctionUser (userId),
constraint FK_rec_REF_AUC foreign key (auctionId)
references auction (auctionId)
)tablespace auctionDB;
------------添加表的描述信息
comment on table auction is
‘拍卖品‘;
comment on column auction.auctionId is
‘拍卖品编号‘;
comment on column auction.auctionName is
‘拍卖品名称‘;