1 / 3
文档名称:

《数据查询》练习的答案.doc

格式:doc   大小:28KB   页数:3页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

《数据查询》练习的答案.doc

上传人:xunlai783 2019/5/19 文件大小:28 KB

下载得到文件列表

《数据查询》练习的答案.doc

文档介绍

文档介绍:学生表“Student”中查询出男生的学号、姓名、性别的数据信息。selectSID,Sname,SexfromStudentwhereSex='男'学生表“Student”中查询出前20%的数据行selecttop20percentSID,Sname,Sex,BirthdayfromStudent学生表“Student”中查询出学校各专业的名称(不允许出现重复字段)selectdistinctspecialtyfromStudent学生表“Student”中查询出学生赵成刚的信息。select*fromStudentwhereSname='赵成刚'学生表“Student”中查询出男生的信息。select*fromStudentwhereSex='男'学生表“Student”中查询出在‘1985-12-1’之前出生的学生的信息select*fromStudentwhereBirthday<'1985-12-1'学生表“Student”中查询出在‘1985-12-1’之前出生的女学生的信息select*fromStudentwhereBirthday<'1985-12-1'andSex='女'学生表“Student”中查询姓“李”的学生信息select*fromStudentwhereSnamelike'李%'学生表“Student”中查询学号为2005216007和2006216578的学生信息select*fromStudentwhereSID=2005216007orSID=200621657学生表“Student”中查询出各专业的学生总数,要求查询结果显示专业名称和人数两个列selectspecialty,count(*)as人数fromStudentgroupbyspecialty学生表“Student”中查询出各专业的学生总数,要求显示专业人数>4的专业名称和人数selectspecialty,count(*)as人数fromStudentgroupbyspecialtyhavingcount(*)>4在图书管理数据库“Library”中进行操作:图书表“book”中查询出前5行数据。selecttop5bid,bname,authorfrombook读者类型表“ReaderType”中查询出所有数据。select*fromReaderType图书表“book”中查询出所有图书折价90%后的价格selectbid,bname,author,p,price,price*“book”中统计出高等教育出版社出版的图书数量(使用count())selectcount(*)p='高等教育出版社'图书表“book”中统计各出版社的个数(每个出版社只计数一次)selectcount(distinct(p))as出版社个数frombook图书表“book”中查询出图书的总册数、最高价、最低价、总价值、折扣后的总价值和评价价selectcount(price)as册数,max(price)as最高价,min(price)as最低价,sum(price)as总价值,sum(price*)as折价后的总价值,avg(price)as平均价frombook图书表“book”中查询定价在10元到15元之间的图书信息。