← Back to topic library
Dev MaxxingIntermediateDatabases75 sec
SQL query
A SQL query is a statement written in SQL that requests or modifies data in a relational database, such as retrieving matching rows or updating values.
Prerequisite: Relational database
What matters
Because SQL lets you describe what data you want rather than how to fetch it step by step, the database itself decides how to efficiently execute the request.
Example
'SELECT name FROM users WHERE age > 18' retrieves the names of every user row where the age column exceeds 18.
Common misconception
A SQL query is not limited to reading data; SQL also includes statements for inserting, updating, and deleting rows, not only 'SELECT'.
Recall question
What does a SQL query describe, compared to a step-by-step retrieval procedure?
Keywords and related concepts
SQL querySELECTdatabasedatabase index