SQL is not a Programming Language
SQL is not a Programming Language. You’ve probably heard someone say “I know SQL” when asked about programming languages. Or maybe you’ve seen job ads listing SQL next to Python, Java, or C#.
Technically, they’re wrong.
SQL is not a programming language.
It’s a query language, and that difference is its greatest strength.
Let me explain why, and why it’s perfectly fine that way.
Imperative vs. Declarative
The big difference.
Most programming languages (Python, JavaScript, C++, etc.) are imperative.
You tell the computer how to do something, step by step:
python
total = 0
for order in orders:
if order.customer_id == 123:
total += order.amount
print(total)
You describe the loop, the condition, the addition, the exact procedure.
SQL is declarative.
You tell the database what you want, not how to get it:
SELECT SUM(amount)
FROM orders
WHERE customer_id = 123;
You describe the result you want. The database engine figures out the best way to get it (indexes, join order, parallel execution, etc.).
That’s why SQL feels different, and why it’s so powerful for data work.
Set-based thinking: SQL’s superpower
Programming languages usually work with one thing at a time (loops, variables).
SQL thinks in sets, entire tables or result sets at once.
Example: give every employee a 10% raise.
Imperative style (pseudo-code):
for each employee in employees:
employee.salary = employee.salary * 1.10
save employee
SQL style, one statement:
UPDATE employees
SET salary = salary * 1.10;
The database handles millions of rows efficiently, in bulk.
This set-based approach is why SQL is fast on large data, and why trying to write loop thinking in SQL (with cursors) is usually slow and wrong.
The difference
Aspect: imperative languages (Python, Java, etc.).
Focus: how to solve it (step-by-step).
Processing: one record at a time (loops).
Optimization: you decide the algorithm.
Typical use: general applications, logic, UI.
Example mindset: loop through rows and add.
Aspect: declarative SQL.
Focus: what result you want.
Processing: whole sets at once.
Optimization: database optimizer chooses the best plan.
Typical use: data retrieval, manipulation, reporting.
Example mindset: give me the sum where…
Why SQL doesn’t need to be a full programming language
SQL excels at:
Retrieving data (SELECT)
Filtering, joining, grouping
Inserting/updating/deleting
Defining structure (tables, views, indexes)
It’s deliberately limited:
No real variables (in basic SQL)
Limited looping
No file I/O or network calls
And that’s okay!
You combine SQL with a real programming language (Python, C#, Java) when you need more control.
Think of SQL as the perfect tool for what questions about data.
Use Python/JavaScript/etc. for the how when you need it.
My real-world view (35 years in Banking IT)
In banking systems, 90% of the heavy data work was pure SQL, fast, reliable, maintainable.
The other 10%? Wrapped in application code (C#, Java) that called the SQL.
Trying to force SQL to do everything (procedural tricks, cursors) always led to slow, buggy reports.
Good developers know:
Use the right tool for the job.
SQL is the best tool for data retrieval and manipulation, precisely because it’s not a full programming language.
Final thought
Next time someone says SQL is a programming language, smile and say:
No, it’s better.
It lets you think about what the data should be, not how to loop through it.
And that’s why it’s still unbeatable after 50 years.
What do you think, does SQL feel like programming to you? Share in the comments!
This brings us to the end of my post on SQL is not a Programming Language
Thank you for taking the time to read my post on SQL is not a Programming Language.
I hope you found it enjoyable and insightful.
Stay tuned for more content that is coming soon.
If you like what you read, please consider sharing it with others who might find it helpful.
Contact me
If you have any questions or want to contact me, please drop me an email at info@safecomputer.org
Stay updated with my monthly newsletter
Subscribe to Safe Computer’s monthly newsletter in the right sidebar for tips on job applications, cybersecurity, and more! Get summaries of my latest posts, like this Database Crimes, straight to your inbox. Join now at safecomputer.org!
Disclaimer
All tips and methods mentioned in this blog are tested on Windows 11. Please note that results may vary on other operating systems or versions of Windows. Adapt the instructions accordingly.
Copyright
© 2025 Henny Staas/safecomputer.org. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Henny Staas/safecomputer.org with appropriate and specific direction to the original content.