What Is SQL?

Structured Query Language, or SQL (pronounced "sequel"), is code that gets and manipulates data in a relational database. Before we go into more details about SQL, we need to discuss relational databases.

Data Are Everywhere, and So Are Databases

Every organization needs to store and process data, and can benefit from a database. There are 100s of different databases available, and we can categorize them by their database model. A database model is a way of structuring and organizing the data in the database. Some examples of database models are the graph model, document model, and relational model. Databases that use the relational model, for example, are called "relational databases".

More info on these models.
  • Graph Model - The data are a network of things (nodes) connected by edges. This is good for highly interconnected data.
  • Document Model - The data are semi-structured documents. Usually these are JSON or XML. Traditionally, each document is self-contained rather than interconnected with other documents.
  • Relational Model - Keep reading!

Relational databases are the most popular type, and all of them use SQL, which is the standard language for them. By learning this 1 language, you have the foundations to query all relational databases! In fact, even several non-relational databases have adopted it, because so many people know it!

postgres maria DB mysql microsoft SQL server oracle sqlite cockroach DB google bigquery snowflake IBM db2
Logos of a few databases that use SQL.

At the time of writing, according to db-engines.com, more than 60% of the top 25 most popular databases are relational databases. Of the top 5 most popular, 4 of them are relational. People like this model because it can represent data for any application while providing data integrity and flexible query capabilities thanks to SQL.

Despite being standardized, there are slight differences in the SQL used by each. This tutorial will focus on the one used by PostgreSQL, or "Postgres" for short. We need to discuss what the relational model means. Before we do that, let's have you write an actual SQL query in the next section!

© 2022 Andrew Carlson. All rights reserved.