not EXISTS ile alt sorgular

not EXISTS EXISTS gibi kullanılan where yan tümce tümce tümce alt sorgu tarafından döndürülen satır yok, memnun dışında çalışır.

Örneğin, tekerlekleri alt kategorisi içinde yer almayan ürünlerin bulmak için şunu yazın:

USE AdventureWorks2008R2;
GO
SELECT Name
FROM Production.Product
WHERE NOT EXISTS
    (SELECT * 
     FROM Production.ProductSubcategory
     WHERE ProductSubcategoryID = 
            Production.Product.ProductSubcategoryID
        AND Name = 'Wheels')