What is SQL?

TL;DR

SQL (Structured Query Language) is the language you use to talk to databases. You write simple English-like commands to ask questions about your data, add new records, update existing ones, or delete what you don't need.

From the Editor's Desk

SQL's NULL handling is the concept that bites most developers who learned it informally. NULL is not zero, not an empty string, and not false — it is the absence of a value, and comparisons with NULL always return NULL, not true or false. That means WHERE column != 'foo' silently excludes rows where column IS NULL. On a report that was missing 15% of its expected rows, this was the culprit: a LEFT JOIN with a filter in the WHERE clause that should have been in the ON clause. The PostgreSQL comparison operators documentation explains the NULL semantics clearly.

Implicit type coercion is the other silent query-killer. In databases with aggressive coercion (looking at MySQL), comparing a VARCHAR column to an integer can prevent index usage entirely, resulting in a full table scan. The query runs correctly but takes 10 seconds instead of 10 milliseconds. Always verify query plans with EXPLAIN when a query seems slower than it should be. The Use The Index, Luke guide is the most practical reference for SQL query optimization available online.

If you are deciding whether to learn SQL deeply or rely on an ORM: any role that involves analytics, data engineering, or backend development benefits from strong SQL. ORMs hide complexity but they also hide performance problems; when a query is slow, you eventually have to read the generated SQL anyway.

The Big Picture

SQL sits between you and your data. Here's the full flow from question to answer:

How SQL works: You write a query, the database engine parses, plans and executes it against your tables, and returns a result set
🧒 Explain Like I'm 12

Imagine a huge library with thousands of books. SQL is like the librarian. You walk up and say "Find me all the science fiction books published after 2020, sorted by rating." The librarian (SQL) knows exactly where to look, grabs the right books, and hands them to you in a neat pile. You don't need to know which shelf they're on — you just describe what you want.

What is SQL?

SQL stands for Structured Query Language. It was invented in the 1970s and is still the most widely used language for working with data. Every time you use an app that stores information — your bank, social media, online shopping — SQL is almost certainly running behind the scenes.

SQL is declarative: you describe what you want, not how to get it. You say "give me all orders over $100" and the database figures out the fastest way to find them. This is the opposite of most programming languages where you write step-by-step instructions.

Who is it for?

Anyone who works with data. Backend developers write SQL to power their apps. Data analysts use it to answer business questions. Data scientists query databases before building models. Even product managers learn basic SQL to pull their own numbers instead of waiting on engineers.

If you can write a sentence, you can write SQL. It reads almost like English.

What can you do with SQL?

  • Query data — ask questions and get answers from millions of rows in milliseconds
  • Filter and sort — narrow down results to exactly what you need
  • Combine tables — JOIN data from different tables to see the full picture
  • Aggregate — count, sum, average, find min/max across groups of data
  • Insert, update, delete — modify data, not just read it
  • Create structure — define tables, columns, and relationships
  • Control access — grant and revoke permissions on who can see what

Where does SQL run?

SQL runs on a database engine. The most popular ones are:

🐘
PostgreSQL
Open source, feature-rich, great for production apps
🐎
MySQL
Popular for web apps, powers WordPress and many startups
ðŸŠķ
SQLite
Lightweight, file-based, runs on phones and embedded devices
ðŸĒ
SQL Server
Microsoft's enterprise database for large organizations

The core SQL language is the same across all of them. Once you learn it, you can use any database.

What you'll learn

This topic covers core concepts plus deep dives. Each one builds on the last:

Start Learning: Core Concepts →

Test Yourself

What does SQL stand for?

Structured Query Language.

Is SQL declarative or imperative? What's the difference?

Declarative. You describe what you want, not how to get it. The database engine figures out the fastest execution plan.

Name two database engines that use SQL.

PostgreSQL, MySQL, SQLite, SQL Server (any two count).

What are the four main things you can do with data using SQL?

SELECT (read), INSERT (create), UPDATE (modify), DELETE (remove) — often called CRUD operations.