赞
踩
- mysql> select bid as 图书编号,bname as 书名,author as 作者, publisher as 出版社, price as 价格
- -> from book
- -> where publisher='人民邮电出版社';
- mysql> select rname as 姓名,sex as 性别, dept as 所属院系
- -> from reader
- -> where sex = '女';
- mysql> select bid as 图书编号,bname as 书名,author as 作者,publishdate as 出版日期,price as 定价
- -> from book
- -> where publishdate between "2017-01-01" and "2019-12-31";
- mysql> select bid as 书名, bname as 书名, price*0.7 as 打折后价格
- -> from book;
- mysql> select count(bid) as 总类别数量, sum(total) as 总库存数量
- -> from book;
- mysql> select rname as 读者姓名, bname as 书名
- -> from borrow join reader on reader.rid= borrow.rid
- -> join book on borrow.bid = book.bid
- -> where bname like "%数据%";
- mysql> select rname as 读者姓名,bname as 书名,borrowtime as 借阅日期
- -> from borrow join reader on reader.rid= borrow.rid
- -> join book on borrow.bid = book.bid
- -> where typeno in(select typeno from readertype where typename="教师");
- mysql> select borrow.rid as 读者编号,rname as 读者姓名,bname as 书名, borrowtime as 借阅日期
- -> from borrow join reader on reader.rid= borrow.rid
- -> join book on borrow.bid = book.bid
- -> where returntime is null;
- mysql> select borrow.bid as 图书编号,bname as 书名,count(borrowtime) as 借阅次数,
- -> author as 作者,publisher as 出版社
- -> from borrow,book where borrow.bid=book.bid
- -> group by borrow.bid
- -> order by count(borrowtime) desc;
- mysql> select reader.dept as 院系名称, count(borrowtime) as 借阅次数
- -> from borrow,reader where borrow.rid=reader.rid
- -> group by reader.dept
- -> order by count(borrowtime) desc;
- mysql> select a.rid as 读者编号,a.rname as 读者姓名, b.bname as 书名,
- -> c.borrowtime as 借阅日期
- -> from borrow c join reader a on c.rid=a.rid
- -> join book b on b.bid=c.bid
- -> where returntime is null and c.bid=
- -> (select d.bid from book d where bname="大数据技术基础");
- mysql> select bid as 图书编号, bname as 书名, author as 作者,
- -> publisher as 出版社, price as 定价
- -> from book where price >
- -> (select avg(price) from book);
- mysql> select bid as 图书编号, bname as 书名, author as 作者,
- -> publisher as 出版社, price as 定价
- -> from book where bid not in
- -> (select bid from borrow);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。