一个公司有不同类型的产品(火车,摩托车,汽车等。)从这个sample database:查询选择公司数据
ORDERDETAILS table contains Ordernumber and Productcode
PRODUCTS table contains Productcode and Productline
查询到列表中的顺序号,其中包括要么轮船或火车是:
Select DISTINCT ordernumber from orderdetails
WHERE productcode IN (
Select productcode
From products
where Productline =’ships’or productline =’train’
);
如何列出有都 PRODUCTLINE“船舶”和“火车”的订单编号?
这给了我一个空集:
Select DISTINCT ordernumber FROM orderdetails
WHERE productcode IN (
Select productcode
From products
where Productline =’ships’ AND productline =’train’
);
为什么我就不能改变“或”以“和”?什么是空集的正确语法?