# Lesson 6: Subqueries This lesson covers subqueries. You'll read a short explanation, try three small exercises and finish with a quiz. Full lesson: [https://glibcode.net/courses/sql-essentials/lessons/6](https://glibcode.net/courses/sql-essentials/lessons/6) ## Files - `subqueries.sql`: subqueries in WHERE and FROM > **Tip:** Write the FROM and JOIN lines first, then SELECT: it matches how the database reads the query. > **Tip:** `.mode box` and `.headers on` in sqlite3 make results much easier to read. ## Run it ```sh sqlite3 shop.db < ../../setup/schema.sql sqlite3 shop.db < ../../setup/seed.sql sqlite3 shop.db < subqueries.sql ``` ## Exercises See [exercises.md](exercises.md). Ask in the forum after you have tried.