问题是,
确定船舶表中满足以下列表中至少四个标准组合的所有船舶的名称:numGuns = 8 bore = 15 displacement = 32000 type = bb started = 1915 class = Kongo country = USA.
我找到了这个练习的答案.
答案是,
SELECT s.name from ship s,classes c WHERE s.class=c.class AND ((numGuns = 8 AND bore = 15 AND displacement = 32000 AND type = 'bb') OR (numGuns = 8 AND bore = 15 AND displacement = 32000 AND launched = 1915) OR (numGuns = 8 AND bore = 15 AND displacement = 32000 AND c.class = 'Kongo') OR (numGuns = 8 AND bore = 15 AND displacement = 32000 AND country = 'USA') OR (numGuns = 8 AND bore = 15 AND type = 'bb' AND launched = 1915) OR (numGuns = 8 AND bore = 15 AND type = 'bb' AND c.class = 'kongo') OR (numGuns = 8 AND bore = 15 AND type = 'bb' AND country = 'USA') OR (numGuns = 8 AND bore = 15 AND launched = 1915 AND c.class = 'Kongo') OR (numGuns = 8 AND bore = 15 AND launched = 1915 AND country = 'USA') OR (numGuns = 8 AND bore = 15 AND c.class = 'Kongo' AND country = 'USA') OR (numGuns = 8 AND displacement = 32000 AND type = 'bb' AND launched = 1915) OR (numGuns = 8 AND displacement = 32000 AND type = 'bb' AND c.class = 'kongo') OR (numGuns = 8 AND displacement = 32000 AND type = 'bb' AND country = 'USA') OR (numGuns = 8 AND displacement = 32000 AND launched = 1915 AND c.class = 'Kongo') OR (numGuns = 8 AND displacement = 32000 AND launched = 1915 AND country = 'USA') O
我的问题是,
有没有其他简单的方法检查条件.