Avoid Correlated Subselects: A correlated subselect is a nested select that refers to a column from the outer select. Here is an example that uses product.id as a correlation column to find all products that have no sales orders:
select product.id
from product
where not exists (
select sales_order_items.id
from sales_order_items
where sales_order_items.prod_id = product.id )