# Structured Query Language (SQL)

> A code to ask a database for data. You use it to change data too.

**Field:** Software Development  
**Category:** Databases  
**Also known as:** SQL, Sequel

## Think of it like

Think of it like a clear note to a book shop. Find all books by this writer, oldest first.

## Definition

SQL is the language used to talk to relational databases. You use it to create tables, add rows, change them and ask questions of the data. A question in SQL reads almost like English, such as SELECT name FROM customers. The database works out the fastest way to answer it. PostgreSQL, MySQL and SQLite all speak SQL, each with small differences.

## Example

Emma wants every customer in London. She types one line of SQL, and the database returns the list.

## Example code

```sql
SELECT name, city FROM customers WHERE city = 'London';
-- Emma | London
```

Ask for two columns, but only the rows where the city is London.

## Why it matters

SQL has been the way to work with data for 50 years. Developers and analysts both use it every day.

## Common mistake

Building SQL by gluing in text a user typed. That opens the door to SQL injection; use parameters instead.

## Three principles

- **Say what, not how.** The database picks the way.
- **Reads like English.** SELECT, FROM, WHERE.
- **One language, many databases.** Small dialects, same core.

## Related terms

- [Database](https://learn.benibix.com/term/development/database)
- [Database Query](https://learn.benibix.com/term/development/query)
- [Relational Database](https://learn.benibix.com/term/development/relational-database)
- [SQL Join](https://learn.benibix.com/term/development/join)
- [SELECT Statement](https://learn.benibix.com/term/development/select-statement)
- [Create, Read, Update, Delete (CRUD)](https://learn.benibix.com/term/development/crud)
- [Domain-Specific Language (DSL)](https://learn.benibix.com/term/development/domain-specific-language)

---

Source: https://learn.benibix.com/term/development/sql
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
