Apps and websites
When you log in, check an order or scroll a feed, the app usually runs SQL behind the scenes to fetch your rows.
Free Lesson
SQL (Structured Query Language) is the standard language for asking a database questions and changing its data. You write short, English-like commands such as SELECT title FROM songs WHERE year > 2020, and the database sends back exactly the rows you asked for.
IBM researchers Donald Chamberlin and Raymond Boyce created it in the early 1970s as SEQUEL, which is why many people still say “sequel” as well as “S-Q-L”. It became an ANSI standard in 1986 and is now understood by PostgreSQL, MySQL, SQLite, SQL Server and Oracle. New to databases? Start with what a database is, then run a query below.
Interactive demo
Start with a lesson, or build your own query against the 8-row songs table. Press Run to see the result grid. Everything runs in your browser; nothing is sent anywhere.
query.sql
SELECT *
FROM songs;SELECT * means every column. FROM names the table. This is the first query almost everyone writes.
Press Run to see the result
Six questions on what SQL is and what it does.
Real world
When you log in, check an order or scroll a feed, the app usually runs SQL behind the scenes to fetch your rows.
Analysts write SQL to answer questions like last month's sales by region, then feed the result into dashboards.
Before training a model or building a chart, data scientists pull and clean the data they need with SQL.
SQLite, a tiny SQL database, ships inside every iPhone, Android phone and major web browser to store local data.
Compare
| Aspect | SQL | Excel |
|---|---|---|
| What it is | A language for asking a database questions | A spreadsheet app you click and type into |
| How much data | Millions or billions of rows | Up to 1,048,576 rows per sheet, and slow well before that |
| How you work | Write a query once, rerun it any time | Filter, sort and copy by hand, or with formulas |
| Sharing | Many people and apps read the same live data | Copies of the file drift apart over time |
| Best for | Apps, large or shared data, repeatable reports | Quick personal analysis, budgets, small lists |
You do not have to choose: many people pull data with SQL, then explore it in a spreadsheet.
The commands
Every SQL statement falls into one of five groups. Beginners spend most of their time in the first two. Some books fold SELECT into DML; the idea is the same.
Ask questions and read data
SELECT title FROM songs;Add, change and delete rows
INSERT INTO songs (title, year) VALUES ('New Song', 2026);Create and change tables
CREATE TABLE songs (title TEXT, year INTEGER);Decide who may see or change data
GRANT SELECT ON songs TO analyst;Save or undo a group of changes
COMMIT; -- or ROLLBACK;Honest answer
The basics are easy; mastery takes practice. SQL has a small core vocabulary and reads like a sentence, so most beginners write useful queries on day one. The hard parts come later: joining many tables correctly, thinking in sets instead of loops, and making big queries fast.
Read whole tables, then pick only the columns you need.
Filter rows with =, >, <, AND, OR and LIKE.
Sort results and keep the top rows.
Summarize data with aggregate functions.
Get totals per group, like plays per artist.
Combine two tables that share a key, like songs and artists.
Load a free sample database such as SQLite's Chinook and answer one question you care about.
Code Card turns your Claude Code, Codex, and OpenClaw sessions into a public developer profile with activity graphs, streaks, badges, and a shareable card, so you can track your coding progress. Start with npx code-card.
FAQ
SQL (Structured Query Language) is the standard language for asking a database questions and changing its data. You write short commands like SELECT title FROM songs WHERE year > 2020, and the database returns the matching rows.
SQL is used to read, add, update and delete data stored in relational databases. Apps use it to load your account and orders, analysts use it for reports and dashboards, and data scientists use it to pull data for charts and AI models.
Basic SQL is one of the easiest technical skills to learn. Most beginners can write useful SELECT, WHERE and ORDER BY queries in a day or two. JOINs, grouping and performance tuning take a few weeks of practice.
Yes. SQL is a declarative query language: you describe the result you want and the database works out how to get it. It is not usually used to build whole apps on its own, so it is often paired with Python, JavaScript or another general-purpose language.
SQL is the language. MySQL is one database product that understands SQL, like PostgreSQL, SQLite, Microsoft SQL Server and Oracle. Each adds a few extras of its own, but the core SELECT, INSERT, UPDATE and DELETE commands work almost the same everywhere.