First page Back Continue Last page Image

Why Use a Subquery

There are times when you find yourself writing code that could be replaced by an algorithm and SQL is no different, if you see the code can do the work for you let it

Basically a subquery is a query inside another query, where the inner query is providing a dynamic argument for the outer query

Imagine writing an inventory query, do you want to list every product in stock separated by commas or just have the database grab all the products with a quantity greater than 0 ?