教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 建筑文档 >

数据库课程设计--图书管理系统(3)

来源:网络收集 时间:2026-03-29
导读: 滨海学院数据库课程设计 (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表 字段名

滨海学院数据库课程设计

(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字,全部文档内容请下载后查看。喜欢就下载吧 ……
数据库课程设计--图书管理系统(3).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/438754.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)