logoalt Hacker News

The Rise of SQL:the second programming language everyone needs to know

79 pointsby b-manlast Thursday at 2:00 PM71 commentsview on HN

Comments

petcattoday at 8:04 PM

I've loved and used Django ORM and SQLAlchemy for many years. It got me a long way in my career. But at this point I've sworn-off using query-builders and ORMs. I just write real, hand-crafted SQL now. These "any db" abstractions just make for the worst query patterns. They're easy and map nicely to your application language, but they're really terrible unless you want to put in the effort to meta-program SQL using whatever constructs the builder library offers you. CTEs? Windows? Correlated subqueries? It's a lot. And they're always lazy, so you never really know when the N+1s are going to happen.

Just write SQL. I figured this out when I realized that my application was written in Rust, but really it was a Postgres application. I use PG-specific features extensively. My data, and database, are the core of everything that my application does, or will ever do. Why am I caring about some convenient abstractions to make it easier to work with in Rust, or Python, or whatever?

Nah. Just write the good SQL for your database.

show 7 replies
bitexplodertoday at 7:56 PM

One of the few things I have used in programming and technology consistently for over 25 years is SQL. Almost no time spent learning how to organize and query data has been a waste in my career.

show 2 replies
infogulchtoday at 10:26 PM

A recent article in the space: What Goes Around Comes Around... And Around... | July 1, 2024 | 30 comments | https://news.ycombinator.com/item?id=40846883

The basic thesis is that the relational model and SQL has been the prevailing choice for database management systems for decades and that won't change soon.

Resubmitted because it's a good one: https://news.ycombinator.com/item?id=46359878

schultzertoday at 10:40 PM

SQL is great, but what is even better is a SOTA client. https://github.com/elixir-dbvisor/sql the BEAM can give you superpowers that no other platform can, handle massive concurrency with the performance that rivals bare metal and c https://erlangforums.com/t/elixir-dbvisor-sql-needs-a-sota-p...

tdfirthtoday at 10:09 PM

If you do backend web development in 99% of software companies then being very good at whatever your RDBMS is is a superpower.

It's definitely worth learning SQL very well, but you also need to learn the data structures your RDBMS uses, how queries translate into operations on that data, and what those operations look like in a query plan.

You can go surprisingly far with just that knowledge.

A great resource is https://use-the-index-luke.com/

gcanyontoday at 8:28 PM

> the second programming language everyone needs to know

Do they though? I've been writing SQL for over twenty years, and my experience is that LLMs have been better at writing it than I am for at least most of 2025, for most use cases. I have zero doubt that I will only be writing SQL when I want to for fun no later than sometime 2027.

show 2 replies
therobots927today at 8:03 PM

The mere existence of Pandas makes me extremely grateful for SQL, because my job would be absolute hell if I had to use pandas or a similar syntax. It’s hard to overemphasize just how perfect SQL is for the job that it does.

show 1 reply
rawgabbittoday at 8:17 PM

SQL has been the main skill I have relied upon my entire career. Yes, I have worked with Pandas and other data libraries; my take away from working with Pandas is it is a pretty language but obfuscates the relational database with a non-relational lanuguage. Relational databases require a relational language which is what SQL is.

pavlovtoday at 9:07 PM

I’ve always hated SQL, but fortunately LLMs write it so well that it’s effectively become a read-only language now. You just need to know enough to check the output.

show 1 reply
pjmlptoday at 8:19 PM

I am quite found of PL/SQL, and stored procedures, no need to waste network bandwith with what can be done on the database.

show 1 reply
FjordWardentoday at 8:02 PM

The CM DB group YT channel is good place to learn about the basics and advanced topics: https://www.youtube.com/@CMUDatabaseGroup

show 1 reply
yawaramintoday at 8:30 PM

Learning SQL basically launched my career as a professional SWENG. Once I knew SQL, I found ways to apply it in even non-technical jobs.

ifh-hntoday at 10:11 PM

I've always gravitated towards query languages and SQL is one of my favourites. I've never really understood the need for ORMs and other abstractions but then I'm not a software developer.

If I was going to chose a "third" language I'd say regex.

bikeshavingtoday at 8:34 PM

This is a nice coincidence.

I’ve been heads-down on publishing a JavaScript full-stack metaframework before the end of the year. However, in the past two weeks I’ve been goaded by Claude Code to extract and publish a separate database client because my vision includes Django-style admin/forms. The idea is to use Zod to define tables, and then use raw SQL fragments with JavaScript template tags. The library adds a tiny bit of magic for the annoying parts of SQL like normalizing join objects, taking care of SELECT clauses and validating writes.

I’m only using it internally right now, but I think this approach is promising. Zod is fantastic for this use-case, and I’m sad I’ve only just discovered it.

https://github.com/bikeshaving/zen

Kwpolskatoday at 10:42 PM

IEEE Spectrum is full of uninspiring blogspam, like this post.

TomasBMtoday at 8:17 PM

Somewhat tangential to the article, but why is SQL considered a programming language?

I understand that's the convention according to the IEEE and Wikipedia [1], but the name itself - Structured Query Language - reveals that its purpose is limited by design. It's a computer language [2] for sure, but why programming?

[1] https://en.wikipedia.org/wiki/List_of_programming_languages

[2] https://en.wikipedia.org/wiki/Computer_language

show 6 replies
namegulftoday at 9:36 PM

Data is the new oil or gold, SQL is the tool, the language to interact with it.

Put it together, it's pure gold!

jinwoo68today at 10:16 PM

Folks, the article is from 3 years ago, 2022.

brikymtoday at 9:52 PM

I much prefer Kusto query language. SQL needs a few tweaks so that it's more type safe and supports auto completion. Some engines support From-first which is a good start.

calebmtoday at 10:16 PM

With LLMs, you should be able to just query in English and have LLMs transpile from English to SQL.

show 1 reply