
在SQL SERVER 2000里面 有一个导入导出数据的嘛,你把要复制出来的数据选上,然后下一步就有复制到什么地方,你就选择EXCEL就可以进行 *** 作了。你试着做一下哈,应该没有问题的!!!!!!!!!
13B
14B
D
4C
5B
6C
8D
11A
12B
13B
-- 一题
create table s--学生表
(sno char(8) primary key,--学号
sname char(10) ,--姓名
sage int ,--年龄
ssex char(2),--性别
sdept char(20))--所在系
create table c--课程表
(cno char(4) primary key,--课程号
cname char(20),--课程名
c_dept char(20),--开课系
teacher char(10))--老师
create table sc--成绩表
(sno char(8) not null,--学号
cno char(4) not null,--课程号
grade int ,--成绩
constraint PK_sc primary key(sno,cno),--主键
constraint PK_s_sno foreign key(sno) references s(sno),--外键
constraint FK_c_cno foreign key(cno) references c(cno))--外键
--二题
--1
select cno,cname
from c
where teacher='刘'
--2
select sname
from s
where ssex='女'
and sno in (select sno
from sc
where cno in(select cno
from c
where teacher='刘'))
--3
select cno
from c
where not exists(select from s,sc
where ssno=scsno
and sccno=ccno
and sname='王乐')
--4
select count(distinct Cno) as 课程门数
from sc
--5
select avg(grade)
from sc
where cno='c4'
--6
select ccno,avg(grade) as avg_grade
from sc,c
where sccno=ccno and teacher='刘'
group by ccno
--7
select sname,sage
from s
where sname like'王%'
--8
select sname,sage
from s
where ssex='男' and
sage>all(select sage
from s
where ssex='女')
--9
insert into s(sno,sname,sage)
values('009','吴',18)
--10
delete from sc
where grade is null
--11
update sc
set grade=0
where cno in (select cno
from c
where cname='数据库')and grade<60
--12
update sc
set grade=grade105
where sno in(select sno from s where ssex='女'
and grade<(select avg(grade) from sc))
用SQL语言实现的功能简单啊~~E-R图的在这上面说不清楚吧。总体来说挺简单的就是画个概念模型嘛 把基本关系连好就可以拉!
2、用SQL语言实现如下功能(10)
1select count(列) from 表 这是求总数的 要是分开的话 +个 where 就行
2select 所有项目 比赛时间 场地 from 表 where 编号=100801
3select 运动员 from 表 where 项目=10005
4create view 成绩视图 as select 运动员 项目 成绩 from 表
大体应该就这样吧。至于E-R图嘛 已知实体就两个了,本人感觉再建2个基本就能满足你这题的要求了。有什么不对的地方有高人看出可以指出。小弟也是SQL菜鸟 希望对你有帮助^ ^
这是在一个student数据库上建立的查询,你可以把邮箱告诉我,我把数据库文件发给你,当然如果你想自己建的话也行,下面是三张表。
sno sname ssex sage sdept
200215121 李勇 男 20 CS
200215122 刘晨 女 19 CS
200215123 王敏 女 18 MA
200215125 张立 男 19 IS
cno cname cpno ccredit
1 数据库 5 4
2 数学 NULL 2
3 信息系统 1 4
4 *** 作系统 6 3
5 数据结构 7 4
6 数据处理 NULL 2
7 PASCAL语言 6 4
sno cno grade
200215121 1 92
200215121 2 85
200215121 3 88
200215122 2 90
200215122 3 80
--1查询所有年龄在20岁以下的学生姓名及其年龄。
select sname,sage
from student
where sage<20
--2查询考试成绩有不及格的学生的学号。
select sno
from sc
where grade<60
--3查询年龄不在19~22岁之间的学生姓名、系别和年龄。
select sname,sdept,sage
from student
where sage not between 19 and 22
--4查询既不是信息系,也不是计算机科学系的学生的姓名和性别。
select sname,ssex
from student
where sdept not in ('IS','CS')
--5查询所有姓刘学生的姓名、学号和性别
select sname,sno,ssex
from student
where sname like '刘%'
--6在Course数据表中添加记录('8','DB_design','2',4),并查询以"DB_"开头,且倒数第3个字符为 i的课程的详细情况
select
from course
where cname like 'DB\_%i__%' escape'\'
--7在SC数据表中添加记录('200215123','1',null),并查询所有有成绩的学生学号和课程号
select sno,cno
from sc
--8查询全体学生情况,查询结果按所在系的系号降序排列,同一系中的学生按年龄升序
select
from student
order by sdept desc,sage asc
--9计算2号课程的学生平均成绩。
select AVG(grade)
from sc
where cno='2'
--10在SC数据表中添加记录('200215123','1',23),统计出不及格的同学学号和不及格的门数。
select studentsno,count(grade)
from sc,student
group by studentsno
having grade<60
--11查询选修1号课程的学生最高分数。
select MAX(grade)
from sc
where cno='1'
--12查询学生200215121选修课程的总学分数。
select SUM(grade)
from sc
where sno='200215121'
--13求各个课程号及相应的选课人数
select cno,COUNT(sno)
from sc
group by cno
--14查询选修了2门以上(包括2门)课程的学生学号
select sno
from sc
group by sno
having count()>=2
--15查询成绩大于等于90分的学生的学号和姓名
select studentsno,sname
from student,sc
where grade>90
--16查询选修了“数据库”课程的学生的学号和姓名
select studentsno,sname
from student inner join sc on studentsno=scsno
where cno=(select cno from course where cname='数据库')
--17查询选修了3号课程且成绩高于此课程平均成绩的学号和成绩
select studentsno,grade
from student inner join sc on studentsno=scsno
where cno='3'
and grade>(select AVG(grade) from sc)
--18查询没有选修1号课程的学生姓名。
select sname
from student,sc
where cno!='1'
--1建立计算机系选修了2号课程的学生视图V1
create view v1
as
select sno,sname,ssex,sage,sdept
from student,course
where sdept='cs' and cno='2'
--2建立信息系选修了1号课程且成绩在90分以上的学生的视图V2
create view v2
as
select studentsno,sname,ssex,sage,sdept
from student,course,sc
where coursecno='2' and grade>90
--3将每门课程的课程号和平均成绩定义为一个视图V3
create view v3(cno,avg_grade)
as
select cno,avg(grade)
from sc
group by cno
--三、创建和执行下列存储过程:
--o 创建语句格式:
--n CREATE Proc[edure] 存储过程名
--[{@参数名 数据类型}[=default][output]]
--As
--Sql语句[…n]
--o 执行语句格式:
--n [exec[ute]] 存储过程名[实参[,output][,…n]
--1查询计算机系学生的考试成绩,列出学生的姓名、课程名和成绩。
select sname,cno,grade
from student,sc
where sdept='cs'
--2查询某个指定系学生的考试成绩,列出学生的姓名、所在系、课程名和成绩。
select sname,sdept,cname,grade
from student,sc,course
where sdept='%'
--3查询某个学生某门课程的考试成绩,列出学生的姓名、课程名和成绩。
select sname,cno,grade
from student,sc
where sname='%' and cname='%'
--4查询某个学生某门课程的考试成绩,若没有指定课程,则默认课程为“数据库基础”。
select sname,cno,grade
from student,sc
where sname='%' and cname='%'
--5统计指定课程的平均成绩,并将统计的结果用输出参数返回。
--6创建带删除数据的存储过程,要求删除考试成绩不及格学生的修课记录。
--7创建带修改数据的存储过程,要求将指定的课程的学分增加2分。
以上就是关于数据库题目,请帮帮忙,十分感谢全部的内容,包括:数据库题目,请帮帮忙,十分感谢、数据库试题(求答案)、帮忙做下数据库题目``等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)