Introduction to MySQL
This is the series of notes prepared for the MySQL class taught at Coalition for Queens during October 2014. The goal is to provide an interactive overview of MySQL and get to writing more and more complicated queries.
Getting Started
- A quick guide on how to install MySQL and a MySQL client to make querying easy
Session I
- Notes, Exercises, Solutions
- Overview of MySQL and relational databases. What are they? How are they used? What are the alternatives?
- Provide a quick overview of the normal forms and what they mean. What impact does it have when they’re violated and go over what well designed databases have.
- Introduce the dataset we will be working with. This will mostly likely be a dataset I’ll pull from some of my side projects that will hopefully be relevant. Currently, I’m thinking of using a database containing some fantasy football data that I’ve scraped.
- Make sure everyone has MySQL installed or can get it installed.
- Introduce the SELECT query.
- Introduce simple aggregate functions.
Session II
- Notes, Exercises, Solutions
- Review the SELECT statement and do a few simple exercises.
- Introduce the IN and LIKE clauses.
- Introduce GROUP BY statement.
- Introduce table joins.
Session III
- Notes and Exercises (HTML) (PDF), Solutions
- Review GROUP BY and JOINs statements.
- Introduce subqueries
- Using subqueries in an IN clause.
- Using subqueries in a JOIN.
Session IV
- Notes and Exercises (HTML) (PDF), Solutions
- Inserting data
- Deleting data
- Modifying tables
- Creating tables