爱宝标签打印机驱动:一道数据库问题

来源:百度文库 编辑:高考问答 时间:2024/05/01 20:20:51
查找每条红色船只被租用的次数
数据库为:
模式
Sailors(sid: integer, sname: string, rating: integer, age: real)
Boats(bid: integer, bname: string, color: string)
Reserves(sid: integer, bid: integer, day: date)
答案是这么写的:
select B.bid,COUNT(*)
from SAILORS S,BOAT B,RESERVES R
where S.sid=R.sid and R.bid=B.bid and B.colour='red'
group by B.bid
问题:为什么要加上SAILORS啊?
如果去掉颜色选择条件,查询结果如何?
如果去掉Sailors和与S.sid相关的条件,情况会怎么样?