我正在分析的查询如下。我想了解第二个EXISTS
如何在这里工作。我的理解是否正确?如果没有,请解释我:
select cust_nofrom customers C1
。NOT EXIST
查询检查第一条记录,以确保它不存在。如果它不存在,则返回TRUE
,否则返回FALSE
。如果TRUE
继续针对第二个NOT EXIST
查询进行检查,并返回TRUE
或FALSE
。SELECT cust_no
FROM customers C1
WHERE NOT EXISTS (
SELECT *
FROM orders, order_details OD1
WHERE orders.order_no = OD1.order_no
AND orders.cust_no = C1.cust_no
AND NOT EXISTS (
SELECT *
FROM products
WHERE OD1.prod_cod = products.prod_cod
AND products.prod_cod = 'STAND'
)
)