ENES

SQL

The language you use to ask a database questions.

A yellow card with a SELECT query points to a database cylinder, which points to a small result table with two highlighted rows

SQL (Structured Query Language, often pronounced 'sequel') is the language for talking to relational databases. You do not tell the database how to find the data, step by step; you describe what you want, and the database works out the fastest way to get it. That is why a few lines of SQL can answer a question over millions of rows.

A query reads almost like an English sentence: SELECT name, city FROM customers WHERE country = 'AR' ORDER BY name; asks for the name and city of every customer in Argentina, alphabetically. Other commands add rows (INSERT), change them (UPDATE) or remove them (DELETE). JOIN combines tables that point to each other, like orders with the customers who placed them, and GROUP BY summarizes, like total sales per month.

SQL dates from the 1970s and is still everywhere: PostgreSQL, MySQL, SQLite (the database inside most phones) and big analytics tools like Amazon Athena or a data warehouse. Each engine adds its own extras, called a dialect, but the core is the same, so learning it once pays off for decades. It is also one of the most useful skills outside engineering: analysts, product managers and marketers use it to answer their own questions.

Keep in mind

Go deeper

Related terms

More in Data