Introduction to SQL
Welcome to SQLBolt, a series of interactive lessons and exercises designed to help you quickly learn SQL right in your browser.
What is SQL?
SQL, or Structured Query Language, is a language designed to allow both technical and non-technical users to query, manipulate, and transform data from a relational database. And due to its simplicity, SQL databases provide safe and scalable storage for millions of websites and mobile applications.
Did you know?
There are many popular SQL databases including SQLite, MySQL, Postgres, Oracle and Microsoft SQL Server. All of them support the common SQL language standard, which is what this site will be teaching, but each implementation can differ in the additional features and storage types it supports.
Relational databases
Before learning the SQL syntax, it's important to have a model for what a relational database actually is. A relational database represents a collection of related (two-dimensional) tables. Each of the tables are similar to an Excel spreadsheet, with a fixed number of named columns (the attributes or properties of the table) and any number of rows of data.
For example, if the Department of Motor Vehicles had a database, you might find a table containing all the known vehicles that people in the state are driving. This table might need to store the model name, type, number of wheels, and number of doors of each vehicle for example.
Table: Vehicles
| Id | Make/Model | # Wheels | # Doors | Type |
|---|---|---|---|---|
| 1 | Ford Focus | 4 | 4 | Sedan |
| 2 | Tesla Roadster | 4 | 2 | Sports |
| 3 | Kawakasi Ninja | 2 | 0 | Motorcycle |
| 4 | McLaren Formula 1 | 4 | 0 | Race |
| 5 | Tesla S | 4 | 4 | Sedan |
In such a database, you might find additional related tables containing information such as a list of all registered drivers in the state, the types of driving licenses that can be granted, or even driving violations for each driver.
By learning SQL, the goal is to learn how to answer specific questions about this data, like "What types of vehicles are on the road have less than four wheels?", or "How many models of cars does Tesla produce?", to help us make better decisions down the road.
About the lessons
Since most users will be learning SQL to interact with an existing database, the lessons begin by introducing you to the various parts of an SQL query. The later lessons will then show you how to alter a table (or schema) and create new tables from scratch.
Each lesson will introduce a different concept and end with an interactive exercise. Go at your pace and don't be afraid to spend time experimenting with the exercises before continuing! If you happen to be familiar with SQL already, you can skip ahead using the links in the top-right, but we would recommend you work through the lessons anyways!
By the end, we hope you will be able to have a strong foundation for using SQL in your own projects and beyond.
The current page is the Introduction to SQL lesson on SQLBolt.
- Purpose: SQLBolt offers interactive lessons and exercises to help users learn SQL directly in their browser.
- What is SQL? SQL (Structured Query Language) lets users of all skill levels query, manipulate, and transform data in relational databases. It is widely used because of its simplicity and scalability, supported by many database systems like SQLite, MySQL, Postgres, Oracle, and Microsoft SQL Server.
- Relational Databases: The lesson explains relational databases as collections of related tables (similar to Excel spreadsheets) with named columns and rows of data. An example is given with a "Vehicles" table showing attributes like Make/Model, number of wheels, and doors.
- Learning Goals: The course helps you learn to answer questions from data, such as identifying vehicle types or counting specific models.
- Lesson Structure: Lessons start with basic SQL queries and advance to creating and altering tables, with interactive exercises after each concept. There are options to skip ahead if already familiar with certain material.
- End Goal: By completing these lessons, you’ll gain a strong SQL foundation to use in various data projects.
- Navigation: There’s a link to begin Lesson 1 on writing SQL queries.
Overall, the page welcomes users and sets expectations for the learning pathway in SQL provided by SQLBolt’s interactive format.[1]