SQL
SQL, short for Structured Query Language, is a declarative language for defining, querying, and modifying the data held in a relational database, where information is organized into tables of rows and columns.
Being declarative means a statement describes the desired result rather than the procedure to compute it. The database’s query planner decides how to satisfy the request, choosing indexes and join strategies automatically. The language traces back to the relational model that Edgar F. Codd formalized in 1970, and it was first standardized by ANSI in 1986 and by ISO in 1987.
SQL statements fall into a few families:
- Data definition (
CREATE,ALTER,DROP) sets up the tables and constraints that form a schema. - Data manipulation (
INSERT,UPDATE,DELETE) changes the rows a table holds. - Queries (
SELECT) read data back, often filtering, joining, and aggregating across several tables. - Transaction and access control (
COMMIT,ROLLBACK,GRANT) govern durability and permissions.
Every major database ships its own SQL dialect that extends the standard, so a query written for one engine may need changes to run on another. Python programs reach relational databases through the DB-API, a common interface defined in PEP 249, and the standard library bundles the sqlite3 module for working with a self-contained SQL database.
Related Resources
Tutorial
Handling SQL Databases With PyQt: The Basics
In this step-by-step tutorial, you’ll learn how to use PyQt's built-in SQL support to create GUI applications that effectively manage SQL databases.
For additional information on related topics, take a look at the following resources:
- SQLite and SQLAlchemy in Python: Move Your Data Beyond Flat Files (Course)
- MySQL Databases and Python (Course)
- Preventing SQL Injection Attacks With Python (Tutorial)
- Introduction to Python SQL Libraries (Tutorial)
- Data Management With Python, SQLite, and SQLAlchemy (Tutorial)
- Python and MySQL Database: A Practical Introduction (Tutorial)
- Introduction to Python SQL Libraries (Quiz)
- Data Management With Python, SQLite, and SQLAlchemy (Quiz)
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Martin Breuss • Updated Sept. 29, 2026