在sqlite中是否只有'only'这样的关键字?我必须写一个查询来显示只保留红船的水手名称。所以我当前的查询是:仅在哪里查询?
select s.sname
from sailor s, boat b, reservation r
where s.sname = r.sname
and b.bname = r.bname
and b.color = 'red';
与上面的查询,还显示谁有权红+其他彩船水手名称的问题。我的查询结果:
a reserve red boat
a reserve green boat
b reserve red boat
但它应该只显示b,因为他只保留红船。
谢谢你,但它也显示水手谁选择其他颜色的船。 – 2014-11-06 04:52:39
@something,我试过了,它给出了正确的结果,这里是sql小提琴http://www.sqlfiddle.com/#!7/dbaa2/1 – radar 2014-11-06 05:05:56