没有合适的资源?快使用搜索试试~ 我知道了~
数据库实验报告(包含建表语句,查询语句)
3星 · 超过75%的资源 需积分: 9 14 下载量 151 浏览量
2010-12-12
20:14:32
上传
评论 1
收藏 894KB DOC 举报
温馨提示
试读
12页
数据库实验报告,是学生表的建立,总共四张表,建立了相应的关系。包含几乎所有不同的查询功能。
资源推荐
资源详情
资源评论
数据库系统概论
实验报告
系 别 电子信息系
专 业 计算机科学与技术
班级学号
x x
姓 名
x x
指导教师 李佳音
成 绩
2 010 年 12 月 15 号
一.实验目的:
通过sql server软件来建立多张表格,并且确定相应的关系,再
建立相应的脚本,来进行查询,达到熟悉数据库工作流程,了解数
据库工作原理目的。
二.实验要求:
建一个数据库,包含3~5张表,保留sql语言脚本。
三.实验内容和相应的结果(截图)
1.初始化部分
--创建数据库
create database huanglei
use huanglei;
--删除表格
drop table course,student,student_course,class;
--删除数据库
drop database huanglei;
--创建数据库
create table student(
student_id char(8) not null primary key,
student_name char(8) not null ,
student_sex bit not null,
student_birth smalldatetime not null,
class_id char(6) not null,
entrance_date smalldatetime not null,
foreign key (class_id) references class(class_id)
)
--student2表主要是做cross join查询
create table student2(
student_id char(8) not null primary key,
student_name char(8) not null ,
student_sex bit not null,
student_birth smalldatetime not null,
class_id char(6) not null,
entrance_date smalldatetime not null,
foreign key (class_id) references class(class_id)
)
create table class
(class_id char(6)not null primary key,
monitor nvarchar(8) null,
classroom varchar(13)null,
student_num smallint null default 0 )
create table course
(course_id varchar(50) not null primary key,
course_name varchar(50) not null,
teacher varchar(50) not null
)
create table student_course
(course_id varchar(50)not null,
student_id char(8) not null ,
grade tinyint not null,
primary key(course_id,student_id),
foreign key (course_id) references course(course_id),
foreign key (student_id) references student(student_id)
)
--初始化数据
insert student values('4080420','黄磊','1','1988-09-25','40804','2008-09-
01')
insert student values('4080405','市鹏飞','1','1988-08-25','40804','2008-09-
01')
insert student values('4080412','huan','1','1987-09-25','40804','2008-09-
01')
insert student values('4080411','震波','0','1980-09-25','40804','2008-09-
01')
insert student values('4080422','架下伽','0','1986-09-25','40804','2008-09-
01')
insert into student values('4080523','含妹妹','0','1988-09-25','40805','2008-
09-01');
insert into student values('4080533','魄力','1','1988-09-25','40805','2008-
09-01');
insert into student values('4080623','流星','0','1988-09-25','40806','2008-
09-01');
insert into class values('40804','小雨','112','32');
insert into class values('40805','大兵','113','31');
insert into class values('40806','小类','114','32');
insert into course values('122','数学','王欣');
insert into course values('123','English','王欣');
剩余11页未读,继续阅读
资源评论
- 小学生102012-11-11没有多少底层的源码,这是一些sql sever数据库界面中的操作语句。不过也挺好的。
狂风席卷
- 粉丝: 5
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功