Lesson 16 — EXISTS
EXISTS: is there at least one?
EXISTS (subquery) is true when the subquery returns at least one row. It is usually correlated: for each customer, check whether an order exists for them. The database can stop at the first match, so it is fast. NOT EXISTS finds rows with no match.
SELECT title FROM courses c
WHERE EXISTS (SELECT 1 FROM signups s WHERE s.course_id = c.id)
Why it matters: "customers who ordered", "users who never logged in" — yes/no questions about related rows.
Fill in the WHERE inside EXISTS so it matches orders of the current customer. Expected: Ann and Cy.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
A quick 3-question quiz on this lesson — instant feedback.
Ready for more? Optional paid resources that pick up where this lesson leaves off.
Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.
Project-based SQL Deep Dive courses if you want a structured paid path after the free lessons. Wait for a sale — prices drop often.
Browse on Udemy →Search Amazon for SQL Deep Dive books — check the publication year so the examples match current versions.
Search Amazon →