资源描述
在教务管理数据库“ EDUC ”中进行操作:1、学生表“Student”中查询出男生的学号、姓名、性别的数据信息。select SID,Sname,Sexfrom Studentwhere Sex=男2、学生表“Student”中查询出前20%的数据行select top 20 percent SID,Sname,Sex,Birthdayfrom Student3、学生表“Student”中查询出学校各专业的名称(不允许出现重复字段)select distinct specialtyfrom Student4、学生表“Student”中查询出学生赵成刚的信息。select *from Studentwhere Sname= 赵成刚5、学生表“Student”中查询出男生的信息。select *from Studentwhere Sex= 男6、学生表“Student”中查询出在1985-12-1 之前出生的学生的信息select *from Studentwhere Birthday 1985-12-1 7、学生表“Student”中查询出在1985-12-1 之前出生的女学生的信息select *from Studentwhere Birthday 4的专业名称 和人数select specialty,count(*) as 人数from Studentgroup by specialtyhaving count(*)4在图书管理数据库“ Library ”中进行操作:1、图书表“book”中查询出前5行数据。select top 5 bid,bname,authorfrom book2、读者类型表“ ReaderType”中查询出所有数据。select *from ReaderType3、图书表“book”中查询出所有图书折价90%后的价格select bid,bname,author,pubcomp,price,price*0.9 as 折价后的价格 from book4、图书表“book”中统计出高等教育出版社出版的图书数量(使用count()select count(*) as 册数 from bookwhere pubcomp=高等教育出版社5、图书表“ book ”中统计各出版社的个数(每个出版社只计数一次)select count(distinct (pubcomp) as 出版社个数from book6、图书表“ book ”中查询出图书的总册数、最高价、最低价、总价值、折扣后的总价值和 评价价select count (price ) as 册数,max (price ) as 最高价,min (price ) as 最低价, sum (price ) as 总价值,sum (price *0.9) as 折价后的总价值,avg (price ) as 平均价 from book7、 图书表“book”中查询定价在10元到15元之间的图书信息。select bid,bname,price from bookwhere price between 10 and 158、图书表“book”中查询有关ERP方面的图书。select *from bookwhere bname like %ERP%9、从表“Borrow”中查询还没有归还的图书的信息。select book.*from book,borrowwhere book.bid=borrow.bid and borrow.returndate is null10、图书表“ book ”中查询各出版社图书的总价。select pubcomp,sum(price) as 总价 from bookgroup by pubcomp11、图书表“ book ”中查询图书信息,并按照出版社名称升序和价格降序排序select *from bookorder by pubcomp asc,price desc
展开阅读全文