下载此文档

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


文档分类:中学教育 | 页数:约3页 举报非法文档有奖
1/3
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/3 下载此文档
文档列表 文档介绍
在教务管理数据库“EDUC”中进行操作:
学生表“Student”中查询出男生的学号、姓名、性别的数据信息。
select SID,Sname,Sex
from Student
where Sex='男'
学生表“Student”中查询出前20%的数据行
select top 20 percent SID,Sname,Sex,Birthday
from Student
学生表“Student”中查询出学校各专业的名称(不允许出现重复字段)
select distinct specialty
from Student
学生表“Student”中查询出学生赵成刚的信息。
select *
from Student
where Sname='赵成刚'
学生表“Student”中查询出男生的信息。
select *
from Student
where Sex='男'
学生表“Student”中查询出在‘1985-12-1’之前出生的学生的信息
select *
from Student
where Birthday<'1985-12-1'
学生表“Student”中查询出在‘1985-12-1’之前出生的女学生的信息
select *
from Student
where Birthday<'1985-12-1' and Sex='女'
学生表“Student”中查询姓“李”的学生信息
select *
from Student
where Sname like '李%'
学生表“Student”中查询学号为2005216007和2006216578的学生信息
select *
from Student
where SID=2005216007 or SID=200621657
学生表“Student”中查询出各专业的学生总数,要求查询结果显示专业名称和人数两个列
select specialty,count(*) as 人数
from Student
group by specialty
学生表“Student”中查询出各专业的学生总数,要求显示专业人数>4的专业名称和人数
select specialty,count(*) as 人数
from Student
group by specialty
having count(*)>4
在图书管理数据库“Library”中进行操作:
图书表“book”中查询出前5行数据。
select top 5 bid,bname,author
from book
读者类型表“ReaderType”中查询出所有数据。
select *
from ReaderType
图书表“book”中查询出所有图书折价90%后的价格
select bid,bname,author,p,price,price* as 折价后的价格
from book
图书表“book”中统计出高等教育出版社出版的图书数量(使用count())
select count(*) as 册数
from book
where p='高等教育出版社'
图书表“book”中统计各出版社的个数(每个出版社只计数一次)
select count

《数据查询》练习的答案 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数3
  • 收藏数0 收藏
  • 顶次数0
  • 上传人mh900965
  • 文件大小40 KB
  • 时间2018-03-24