数据库课程设计--图书管理系统(3)
滨海学院数据库课程设计
(5)销售表(BCD)
表5-2-5 BCD表 字段名 B_identifier C_identifier sell_count sell_time_year sell_time_mon sell_time_day sell_price sell_money (6)销售单表(BSD)
表5-2-6 BSD表
字段名 B_identifier sell_time_mon sell_counts 字段类型 char(8) int int 约束控制 非空约束 非空约束 非空约束 字段含义说明 图书分类编号 销售时间月 销售总数 字段类型 char(8) char(8) int int int int smallmoney smallmoney 约束控制 主键非空约束 主键非空约束 非空约束 非空约束 非空约束 非空约束 非空约束 非空约束 字段含义说明 图书分类编号 客户编号 销售数量 销售时间年 销售时间月 销售时间日 销售单价 销售金额 6数据库实施
6.1建立实例数据库
6.1.1创建一个书店数据库BS
CREATE DATABASE [BS] ON (
NAME = BS_data,
FILENAME ='D:\\BSdata.mdf', SIZE = 10, MAXSIZE = 100, FILEGROWTH = 10 ) LOG ON
10
滨海学院数据库课程设计
(
NAME =BS_log,
FILENAME = 'D:\\BSdata.ldf', SIZE = 5, MAXSIZE = 25, FILEGROWTH =5 )
6.1.2创建各种数据表
(1)创建图书信息表(BD表) create table BD (
B_identifier char(8)not null constraint B_prim primary key, B_name varchar(50)not null, B_auther varchar(20)not null, B_publish varchar(50)not null
)
(2)创建供应商信息表(GD表) create table GD
( provider varchar(50)not null constraint G_prim primary key, address varchar(50), linkman varchar(20),
telephone bigint not null )
11
滨海学院数据库课程设计
(3)创建供应信息表(BGD表) create table BGD
(
B_identifier char(8) not null constraint fk_bd_bgd foreign key references bd(b_identifier), provider varchar(50)not null,
constraint BGD_Prim primary key(B_identifier,provider),
order_count int not null constraint CK_BGD check(order_count>=0), order_time smalldatatime not null, order_price smallmoney not null, order_money smallmoney not null
)
(4)创建客户信息表(CD表) create table CD (
C_identifier char(8)not null constraint C_prim primary key, C_name varchar(20),
C_sex char(2) not null default'男',
C_age int constraint C_age_Chk check(C_age between 1 and 100)
12
滨海学院数据库课程设计
)
(5)创建销售信息表(BCD表) create table BCD (
B_identifier char(8)not null constraint fk_bd_bcd foreign key references bd(b_identifier), C_identifier char(8)not null,
constraint BCD_Prim primary key(B_identifier,C_identifier), sell_count int not null, sell_time_year int not null, sell_time_mon int not null, sell_time_day int not null, sell_price smallmoney not null, sell_money smallmoney not null
)
(6)创建销售单表(BSD表) create table BSD (
13
滨海学院数据库课程设计
B_identifier char(8)not null constraint fk_bd_bsd foreign key references bd(b_identifier), )
sell_time_mon int not null,
sell_counts int not null constraint CK_BSD check(sell_counts>=0)
(7)各表之间的联系
6.2加载数据及运行测试
6.2.1加载数据
(1) 图书信息表(BD表)
insert into BD(B_identifier,B_name,B_auther,B_publish)
values ('00001','计算机操作系统(第三版)','张默','电子工业出版社') insert into BD(B_identifier,B_name,B_auther,B_publish)
values ('00002','数据库原理(第二版)','汤默','清华大学出版社') insert into BD(B_identifier,B_name,B_auther,B_publish) values ('00003','Java面向对象编程','杨默','人民邮电出版社')
14
…… 此处隐藏:785字,全部文档内容请下载后查看。喜欢就下载吧 ……相关推荐:
- [建筑文档]2018年公需课:专业技术人员创新能力与
- [建筑文档]2013年福建教师招考小学数学历年真题
- [建筑文档]高中信息技术课flash知识点总结 - 图文
- [建筑文档]电工实训 - 图文
- [建筑文档]最高院公告案例分析100篇(民商篇)
- [建筑文档]南开中学高2017级14-15学年(上)期末
- [建筑文档]五粮液集团战略分析
- [建筑文档]鲁教版(2012秋季版)九年级化学 酸碱
- [建筑文档]超星尔雅2017中国哲学概论自整理题库答
- [建筑文档]关于成为海口金盘饮料公司材料独家供货
- [建筑文档]LNG学习资料第一册 基础知识 - 图文
- [建筑文档]四年级品社下册《好大一个家》复习资料
- [建筑文档]现阶段领导权力腐败的特点及发展趋势
- [建筑文档]魏晋南北朝诗歌鉴赏—嵇康
- [建筑文档]坚持追求真爱是理智的行为 正方一辩稿
- [建筑文档]湘西州刑释解教人员帮教安置工作存在的
- [建筑文档]园林工程试题库及答案
- [建筑文档]计算机长期没有向WSUS报告状态
- [建筑文档]日语最新流行语
- [建筑文档]B62-016 景观进场交底专题会议
- 2018年中考语文课内外古诗词鉴赏专题复
- 高考试题研究心得体会
- C语言基础题及答案
- 电气控制及PLC习题及答案
- 都昌小学家长学校汇报材料
- GMAT作文模板正确使用方法
- 俄军办坦克大赛:中国99式有望与豹2A6
- 成本会计练习题
- 酒店餐饮业最流行的5S管理方法
- 2014-2015学年山东省菏泽市高二(下)
- 《黄鹤楼送孟浩然之广陵》教案、说课、
- 2013年结构化学自测题 有答案版
- 2011西安世界园艺博览会游览解说词(附
- 窗口文明单位示范单位创建活动总结
- 2018满分超星尔雅就业课后练习期末答案
- 韶山市城市总体规划-基础资料
- 苏教版第三单元知识点归纳
- 第4章 曲轴模态分析
- 加大查办案件力度的思考
- 武汉CPC导轨介绍




