New course! Every coder should learn Generative AI!
Try a free lesson- 1
It's basically one SQL statement inside another SQL statement. Imagine you have a table for the master data of products, and another table for sales order items. If you want to list all products with order quantities greater than 100, you could write:
SELECT ProductName FROM Product WHERE Id IN (SELECT ProductId FROM OrderItem WHERE Quantity > 100)
http://www.dofactory.com/sql/subquery