Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsamarin/ac353eb13d18bc200b8e7618890f9f01 to your computer and use it in GitHub Desktop.
Save dsamarin/ac353eb13d18bc200b8e7618890f9f01 to your computer and use it in GitHub Desktop.
Let’s say we want to find all orders placed by a particular customer. We can do this by joining the customers and orders tables together using the relationship established by the customer_id key.
SELECT order_date, order_amount
FROM customers
JOIN orders
ON customers.customer_id = orders.customer_id
WHERE customer_id = 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment