NOT EXISTS の機能は EXISTS と似ています。ただし、NOT EXISTS が使用されている WHERE 句が条件を満たすのは、対応するサブクエリによって返される行がない場合です。 たとえば、Wheels サブカテゴリに含まれていない製品の名前を検出するには、次のクエリを実行します。 USE AdventureWorks2008R2; GO SELECT Name FROM Production.Product WHERE NOT EXISTS (SELECT * FROM Production.ProductSubcategory WHERE ProductSubcategoryID = Production.Product.ProductSubcategoryID AND Name = 'Wheels')
![NOT EXISTS を使用したサブクエリ](https://cdn-ak-scissors.b.st-hatena.com/image/square/d6e4cb632c7025e9f5e05fd314fbf6dcd6144e8d/height=288;version=1;width=512/https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fmedia%2Fopen-graph-image.png)