Introduction to SQL
Structured Query Language (SQL) provides a means of creating and manipulating databases, or more specifically, relational database management systems (RDBMS).
Getting Started
For today's class, we're going to use SQLBolt, a website that provides an overview of SQL and then allows one to practise writing queries in the browser.
The order of the lessons provided is intuitive, as it progresses from writing simple queries to creating new tables from scratch.
Let's study the introduction to SELECT
statements together.
Please complete all of the exercises until lesson six; we will cover the introduction of JOIN
s together.
Some of the remaining exercises cover more advanced topics that we can skip for now. Therefore, once we've covered joins, please complete:
- A short note on
NULL
s - Inserting rows
- Updating rows
- Deleting rows
- Creating tables
- Altering tables
- Dropping tables
We will take the occasional break to assess how everyone is progressing, and to share answers to some of the exercises.
Stretch Goals / Homework
SQLite is a portable, file-based database format that supports a subset of SQL syntax.
Head over to the SQLite Tutorial website. Follow the instructions to download an SQLite GUI for your operating system and their sample database, which you will query in the subsequent exercises. Complete as many as possible.
In the next lesson, we will use an Object-Relational Mapper (ORM) in Node.js to query and alter an existing SQLite database.