我正在处理此查询
确定船舶表中所有船舶的名称,这些船舶可能是一艘线性(战斗)日本船,至少有九门主枪,口径小于19英寸,排水量不超过65 000吨。
正确的结果是:
Musashi,
Yamato
我的查询是:
select
name
from
ships A
inner join
classes B on A.class = B.class
where
B.class = ANY (select class
from classes
where country like 'Japan')
and (numguns >= 9 and bore < 19)
我的结果是对的。但该应用程序抛出了错误:
您的查询在第一个(可用)数据库上返回了正确的数据集,但它在第二个检查数据库上返回了不正确的数据集。 *错误的记录数量(少于7)
数据库架构:http://img1.imagilive.com/0315/Snap_23-03-2015_at_151544.jpg
答案 0 :(得分:1)
在这种情况下,“May Be”表示任何搜索条件都可能为NULL,需要考虑
select name from
(select name, s.class, numguns, bore, displacement, type, country
from classes c, ships s where c.class=s.class) a
where (country='japan' or country is null)
and (numguns>=9 or numguns is null)
and (bore<19 or bore is null) and (displacement<=65000 or displacement is null)
and (type='bb' or type is null)
答案 1 :(得分:0)
Set OriginCell = Worksheets("Delta).Range("M2")
Set OriginCell2 = Worksheets("Delta).Range("Q2")
For i = 0 to UBound(myArray)
OriginCell.Offset(i).Value = myArray(i, 2)
OriginCell2.Offset(i).Value = myArray(i, 3)
Next i