Subqueries

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

 

1. https://www.techonthenet.com/sql/exists.php

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

(SELECT *

FROM orders   4) in the orders table

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

 

2. http://www.w3resource.com/sql/subqueries/nested-subqueries.php

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

Advertisements

Author: ajoannaproject

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

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s