SQL Tutorial
Basic SQL
Intermediate SQL
Putting it together
SQL Aggregate Functions
SQL COUNT
SQL SUM
SQL MIN/MAX
SQL AVG
SQL GROUP BY
SQL HAVING
SQL CASE
SQL DISTINCT
SQL Joins
SQL INNER JOIN
SQL Outer Joins
SQL LEFT JOIN
SQL RIGHT JOIN
SQL Joins Using WHERE or ON
SQL FULL OUTER JOIN
SQL UNION
SQL Joins with Comparison Operators
SQL Joins on Multiple Keys
SQL Self Joins
Advanced SQL
SQL Analytics Training
Python Tutorial
Learn Python for business analysis using real-world data. No coding experience necessary.
Start Now
Mode Studio
The Collaborative Data Science Platform
Putting it together
The Intermediate SQL Tutorial
Welcome to the Intermediate SQL Tutorial! If you skipped the Basic SQL Tutorial, you should take a quick peek at this page to get an idea of how to use Mode's SQL editor to get the most out of this tutorial. For convenience, here's the gist:
- Open another window to Mode. Sign up for an account if you don't have one.
- For each lesson, start by running
SELECT *
on the relevant dataset so you get a sense of what the raw data looks like. Do this in that window you just opened to Mode. - Run all of the code blocks in the lesson in Mode in the other window. You'll learn more if you really examine the results and understand what the code is doing.
In the previous tutorial, many of the practice problems could only be solved in one or two ways with the skills you learned. As you progress and problems get harder, there will be many ways of producing the correct results. Keep in mind that the answers to practice problems should be used as a reference, but are by no means the only ways of answering the questions.
The Apple stock prices dataset
For the first few lessons, you'll be working with Apple stock price data. The data was pulled from Google Finance in January 2014. There's one row for each day (indicated in the date
field). open
and close
are the opening and closing prices of the stock on that day. high
and low
are the high and low prices for that day. volume
is the number of shares traded on that day. Some data has been intentionally removed for the sake of this lesson. Check it out for yourself:
SELECT * FROM tutorial.aapl_historical_stock_price
Next Lesson
SQL Aggregate Functions