SESK: Stuff Everyone Should Know · sesk.info/tech-sql-declarative
SQL is called a declarative language. What does that mean?
You describe the data you want, and the database decides how to get it.
- You list each step the computer must follow
- You describe the result and the engine picks the steps ✔
- You can only declare variables
Why: In a SQL query you say which rows and columns you want. The database engine decides whether to scan the table or use an index and in what order to do the work.
Huh, didn't know that: Procedural languages like C are the opposite: the program is a list of instructions saying exactly what to do.
I wrote a declarative grocery list: I want dinner. The database still did not cook it.
Like this card?
References
Answer: You describe the result and the engine picks the steps. In a SQL query you say which rows and columns you want. The database engine decides whether to scan the table or use an index and in what order to do the work.
- Python docs: Functional Programming HOWTO docs.python.org/3/howto/functional.html
a SQL query describes the data set you want to retrieve, and the SQL engine decides whether to scan tables or use indexes
Checked 2026-10-10.
Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.
More stuff everyone should know
That's stuff everyone should know.