MySQL SQL
MySQL EXISTS
Test whether a subquery returns at least one row.
SELECT p.name
FROM products p
WHERE EXISTS (SELECT 1 FROM orders o WHERE o.product_id = p.id);EXISTS stops being interested in additional matching rows once one match is found.
Continue learning
