西南科技大学 Oracle 数据库实验1 建表

--该代码由plsql自动生成,请使用plsql的工具中的导入,sql导入方式导入数据 prompt PL/SQL Developer import file prompt Created on 2013年4月25日 by Administrator set feedback off set define off prompt Creating 读者... create table 读者 ( 借书证号 VARCHAR2(50) not null, 姓名 VARCHAR2(50) not null, 单位 VARCHAR2(50) not null, 性别 VARCHAR2(50) not null, 地址 VARCHAR2(50), 联系电话 VARCHAR2(9), 身份证编号 VARCHAR2(18) ) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); alter table 读者 add primary key (借书证号) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );

prompt Creating 罚款分类... create table 罚款分类 ( 罚款分类号 INTEGER not null, 罚款名称 VARCHAR2(50) not null, 罚金 FLOAT(50) not null ) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); alter table 罚款分类 add primary key (罚款分类号) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );

prompt Creating 书目... create table 书目 ( isbn VARCHAR2(50) not null, 书名 VARCHAR2(50) not null, 作者 VARCHAR2(50) not null, 出版单位 VARCHAR2(50) not null, 单价 FLOAT(10) not null, 图书分类号 VARCHAR2(50) not null ) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); alter table 书目 add primary key (ISBN) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );

prompt Creating 图书... create table 图书 ( 图书编号 VARCHAR2(50) not null, isbn VARCHAR2(50) not null, 是否借出 VARCHAR2(3) not null, 备注 VARCHAR2(999) ) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); alter table 图书 add primary key (图书编号) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); alter table 图书 add constraint ISBN foreign key (ISBN) references 书目 (ISBN);

prompt Creating 借阅... create table 借阅 ( 借阅流水号 INTEGER not null, 借书证号 VARCHAR2(8) not null, 图书编号 VARCHAR2(30) not null, 借书日期 DATE not null, 归还日期 DATE, 罚款分类号 INTEGER, 备注 VARCHAR2(99) ) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); alter table 借阅 add primary key (借阅流水号) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); alter table 借阅 add constraint 借书证号 foreign key (借书证号) references 读者 (借书证号); alter table 借阅 add constraint 图书编号 foreign key (图书编号) references 图书 (图书编号);

prompt Creating 图书分类... create table 图书分类 ( 图书分类号 INTEGER not null, 类名 VARCHAR2(30) not null ) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); alter table 图书分类 add primary key (图书分类号) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );

prompt Creating 预约... create table 预约 ( 预约流水号 INTEGER not null, 借书证号 VARCHAR2(50) not null, isbn VARCHAR2(50) not null, 预约时间 DATE not null ) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited ); alter table 预约 add primary key (预约流水号) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );

prompt Loading 读者... insert into 读者 (借书证号, 姓名, 单位, 性别, 地址, 联系电话, 身份证编号) values ('20051001', '王菲', '四川绵阳西科大计算机学院', '女', null, null, null); insert into 读者 (借书证号, 姓名, 单位, 性别, 地址, 联系电话, 身份证编号) values ('20061234', '郭敬明', '四川江油305', '男', null, null, null); insert into 读者 (借书证号, 姓名, 单位, 性别, 地址, 联系电话, 身份证编号) values ('20062001', '张江', '四川绵阳中心医院', '男', null, null, null); insert into 读者 (借书证号, 姓名, 单位, 性别, 地址, 联系电话, 身份证编号) values ('20071235', '李晓明', '四川成都工商银行', '男', null, null, null); insert into 读者 (借书证号, 姓名, 单位, 性别, 地址, 联系电话, 身份证编号) values ('20081237', '赵鑫', '四川广元广元中学', '女', null, null, null); commit; prompt 5 records loaded prompt Loading 罚款分类... insert into 罚款分类 (罚款分类号, 罚款名称, 罚金) values (1, '延期', 10); insert into 罚款分类 (罚款分类号, 罚款名称, 罚金) values (2, '损坏', 20); insert into 罚款分类 (罚款分类号, 罚款名称, 罚金) values (3, '丢失', 50); commit; prompt 3 records loaded prompt Loading 书目... insert into 书目 (isbn, 书名, 作者, 出版单位, 单价, 图书分类号) values ('7040195836', '数据库系统概论', '王珊', '高等教育出版社', 39, '200'); insert into 书目 (isbn, 书名, 作者, 出版单位, 单价, 图书分类号) values ('9787010073750', '心学之路', '张立文', '人民出版社', 34, '300'); insert into 书目 (isbn, 书名, 作者, 出版单位, 单价, 图书分类号) values ('9787506336239', '红楼梦', '曹雪芹', '作家出版社', 34, '100'); insert into 书目 (isbn, 书名, 作者, 出版单位, 单价, 图书分类号) values ('9787508040110', '红楼梦', '曹雪芹', '人民出版社', 20, '100'); commit; prompt 4 records loaded prompt Loading 图书... insert into 图书 (图书编号, isbn, 是否借出, 备注) values ('1005050', '9787506336239', '否', null); insert into 图书 (图书编号, isbn, 是否借出, 备注) values ('1005063', '9787508040110', '是', null); insert into 图书 (图书编号, isbn, 是否借出, 备注) values ('2001231', '7040195836', '是', null); insert into 图书 (图书编号, isbn, 是否借出, 备注) values ('2001232', '7040195836', '否', null); insert into 图书 (图书编号, isbn, 是否借出, 备注) values ('3007071', '9787010073750', '是', null); commit; prompt 5 records loaded prompt Loading 借阅... insert into 借阅 (借阅流水号, 借书证号, 图书编号, 借书日期, 归还日期, 罚款分类号, 备注) values (1, '20081237', '3007071', to_date('19-09-2010', 'dd-mm-yyyy'), to_date('20-10-2010', 'dd-mm-yyyy'), null, null); insert into 借阅 (借阅流水号, 借书证号, 图书编号, 借书日期, 归还日期, 罚款分类号, 备注) values (2, '20071235', '1005063', to_date('20-10-2010', 'dd-mm-yyyy'), to_date('20-10-2010', 'dd-mm-yyyy'), 1, null); insert into 借阅 (借阅流水号, 借书证号, 图书编号, 借书日期, 归还日期, 罚款分类号, 备注) values (3, '20071235', '2001232', to_date('01-10-2010', 'dd-mm-yyyy'), to_date('16-04-2013', 'dd-mm-yyyy'), 1, null); insert into 借阅 (借阅流水号, 借书证号, 图书编号, 借书日期, 归还日期, 罚款分类号, 备注) values (4, '20061234', '1005063', to_date('20-09-2011', 'dd-mm-yyyy'), to_date('16-04-2013', 'dd-mm-yyyy'), 1, null); insert into 借阅 (借阅流水号, 借书证号, 图书编号, 借书日期, 归还日期, 罚款分类号, 备注) values (5, '20051001', '3007071', to_date('10-09-2011', 'dd-mm-yyyy'), null, null, null); insert into 借阅 (借阅流水号, 借书证号, 图书编号, 借书日期, 归还日期, 罚款分类号, 备注) values (6, '20081237', '3007071', to_date('16-04-2013', 'dd-mm-yyyy'), null, null, null); commit; prompt 6 records loaded prompt Loading 图书分类... insert into 图书分类 (图书分类号, 类名) values (100, '文学'); insert into 图书分类 (图书分类号, 类名) values (200, '科技'); insert into 图书分类 (图书分类号, 类名) values (300, '哲学'); commit; prompt 3 records loaded prompt Loading 预约... insert into 预约 (预约流水号, 借书证号, isbn, 预约时间) values (1, '20081237', '9787508040110', to_date('11-09-2011', 'dd-mm-yyyy')); insert into 预约 (预约流水号, 借书证号, isbn, 预约时间) values (2, '20081237', '9787010073750', to_date('22-04-2013', 'dd-mm-yyyy')); commit; prompt 2 records loaded set feedback on set define on prompt Done.

转载于:https://my.oschina.net/yanpengquan/blog/135370

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值