Intro to Relational Databases >> Deeper into SQL >> Subqueries



This website better explains the EXISTS statement and how to convert a casual statement into a query.


EXISTS Example (the bolded text is the SQl code explained in plain English, not to be included in actual SQL query):


SELECT * 1) find all of the records

FROM customers 2) from the customers table

WHERE EXISTS   3) where there is at least 1 record


FROM orders   4) in the orders table

WHERE customers.customer_id = orders.customer_id); 5) with the same customer_id



This shows visual representation of how to think about queries and subqueries. very helpful for understanding

Screen Shot 2016-10-11 at 11.54.19 AM.png


Author: ajoannaproject

Studying Udacity's Full Stack Web Developer program and passing on my improvements, hints, hacks, and updates to other students via

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s