第一范文网 - 专业文章范例文档资料分享平台

数据库基础练习题解答

来源:用户分享 时间:2025/8/3 14:23:46 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

--1、显示系部编号为“”的系部名称! select departname as '系部名称' from department where departno='03'

--2、查询系部名称中含有“工程”两个字的系的全名。 select departname '系部名称' from department

where departname like'%工程%'

--3、查询共有多少个系部。 select departname '系部名称' from department

compute count(departname)

--4、查询“01”年级共有多少个班级。 select count(classname) as '班级总数' from class

where classname like'01%'

--5、查询在“周二晚”上课的课程名称和教师。 select couname as '课程名称',teacher as '教师' from course

where schooltime='周二晚'

--6、查询姓“张”、“陈”、“黄”同学的的基本信息,要求按照姓名降序排序。 select * from student

Where stuname like'张%' or stuname like'陈%' or stuname like'黄%'

order by stuname desc

--7、按系部统计课程的平均报名人数,要求显示系部编号、平均报名人数。

select departno '系部编号',avg(willnum) '平均报名人数'

from course group by departno

--8、按系部统计课程的平均报名人数,要求显示系部名称、平均报名人数。

select departname '系部名称',avg(willnum) '平均报名人数'

from course,department

where course.departno=department.departno group by departname

--9、统计各系的班级数,要求显示系部编号、系部名称、班级数量。

select class.departno '系部编号',departname '系部名称',count(classname) '班级数量' from class,department

where class.departno=department.departno group by class.departno,departname

--10、查询“甘蕾”同学选修的课程名、学分、上课时间、志愿号,按志愿号排序查询结果。

select couname '课程名',credit '学分',schooltime '上课时间',willorder '志愿号' from course,stucou,student

where course.couno=stucou.couno and student.stuno=stucou.stuno and stuname='甘蕾' order by willorder

--11、显示“电子商务班”班的选修报名结果。要求有学号、姓名、课程编号、

--课程名称、志愿号,并按学号、志愿号排序。

select student.stuno '学号',stuname '姓名',stucou.couno '课程编号',couname '课程名称',willorder '志愿号'

from student,course,stucou,class where course.couno=stucou.couno and student.stuno=stucou.stuno and class.classno=student.classno and classname='00电子商务'

搜索更多关于: 数据库基础练习题解答 的文档
数据库基础练习题解答.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c4lo3w1bkfq6d7jn4l1ze_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top