沈 阳 大 学
课程设计说明书 NO.20
where users.userid=orders.userid and orders.orderid=(
select orderinfo.orderid
from orderinfo,orders
where orders.orderid=orderinfo.orderid and orderinfo.bookid='1'
)
)
图3.11
查询计算机类的所有图书的平均价格:
use tushuguanli
select avg(price)
from book
where book.bookcategory='1'
图3.12
查询每种图书一共订了多少本号书:
use tushuguanli
沈 阳 大 学
课程设计说明书 NO.21
select sum(amount) as '数量',book.bookid
from orderinfo,book
where book.bookid=orderinfo.bookid
group by book.bookid
图3.13
查询订购了图书价格在30-40之间的用户名字:
use tushuguanli
select loginname
from users,orderinfo ,orders
where users.userid=orders.userid and orders.orderid=orderinfo.orderid and orderinfo.bookid=(
select bookid
from book
where book.price between 30 and 40
)
上一页 [1] [2] [3] [4] [5] [6] 下一页