SQL
Structured Query Language
- Pronunciation
- ES-kyoo-EL or SEE-kwul
In short
SQL is the standard language for working with relational databases, used to create tables and to insert, query, update, and delete the data stored in them.
What is SQL?
SQL is a language designed specifically for managing data in relational databases, where information is stored in tables made of rows and columns. It lets you describe what data you want, and the database works out how to find it efficiently. SQL was developed at IBM in the 1970s and is standardized by ANSI and ISO.
SQL is declarative: instead of writing step-by-step loops, you write statements like SELECT, INSERT, UPDATE, and DELETE that describe the result you want. Other statements such as CREATE TABLE define the structure of the data, and JOIN combines rows from related tables, for example matching orders to the customers who placed them.
Nearly every relational database uses SQL, including PostgreSQL, MySQL, SQLite, Microsoft SQL Server, and Oracle Database. Each adds its own extensions, called a dialect, but the core commands work almost the same everywhere. SQL is also used in data analysis tools and data warehouses, which makes it one of the most widely useful skills in software.
SQL is a language, not a database product, so a phrase like 'a SQL database' really means a relational database that you query with SQL. It is often contrasted with NoSQL databases, which use other data models. Both 'S-Q-L' and 'sequel' are accepted pronunciations.
At a glance
Key takeaways
- SQL is the standard language for relational databases.
- It is declarative: you describe the result, not the steps.
- The core commands are
SELECT,INSERT,UPDATE, andDELETE. JOINcombines data from related tables.- Databases share the same core SQL but add their own dialect features.
Example
-- Find the 5 customers who spent the most since the start of 2026
SELECT c.name, SUM(o.total) AS total_spent
FROM customers AS c
JOIN orders AS o ON o.customer_id = c.id
WHERE o.created_at >= '2026-01-01'
GROUP BY c.name
ORDER BY total_spent DESC
LIMIT 5;Readers ask
Is SQL a programming language?
SQL is a domain-specific language for querying and managing data. It is not a general-purpose language like Python or Java, although database extensions such as PL/pgSQL add variables, loops, and functions.
What is the difference between SQL and MySQL?
SQL is the language, while MySQL is a specific database management system that you query using SQL. PostgreSQL, SQLite, and SQL Server are other databases that also use SQL.
Is SQL hard to learn?
The basics, such as SELECT with WHERE and ORDER BY, can be learned in a few hours because the syntax reads close to English. Advanced topics like joins, indexes, and query optimization take longer to master.
Often compared
See also
- DatabaseDatabases, p. 6A database is an organized collection of data stored on a computer, managed by software that lets applications save, search, and update it efficiently.
- NoSQLDatabases, p. 29NoSQL is a family of databases that store data in models other than relational tables, such as documents, key-value pairs, wide columns, or graphs.
- ORMDatabases, p. 33An ORM is a library that maps database tables to objects in your programming language, letting you read and write data with code instead of raw SQL.
- Database IndexDatabases, p. 7A database index is a data structure that helps a database find rows quickly without scanning a whole table, much like the index at the back of a book.
- TransactionDatabases, p. 47A transaction is a group of database operations that succeed or fail as a single unit, so the data is never left in a half-finished, inconsistent state.
- SQL InjectionSecurity, p. 40SQL injection is an attack where user input is treated as part of a database query, letting an attacker read, change, or delete data they should not reach.
- PostgreSQLDatabases, p. 35PostgreSQL is a free, open-source relational database known for reliability, strict standards support and extensions, and widely used for web applications.
- SQLiteDatabases, p. 43SQLite is a small SQL database engine that runs inside your application and stores a whole database in a single file, with no separate server to manage.
Sources
Spotted a mistake or something missing on this page?Suggest an edit