Live data from Hacker News

Learn SQL Once, Use It for 30 Years

fagnerbrack.com

41–50 of 243 posts

Re: Learn SQL Once, Use It for 30 Years

#41
post #38

I’ve always felt that SQL is somewhat easy to grasp for basic queries, but gets complex and difficult for even moderate to higher complexity use cases. My eyes glaze over when I read long stored procedures that someone else has written. Any recommended resources to go from beginner/beginner-intermediate to advanced?

PRQL, or https://www.malloydata.dev/

Re: Learn SQL Once, Use It for 30 Years

#42
post #38

I’ve always felt that SQL is somewhat easy to grasp for basic queries, but gets complex and difficult for even moderate to higher complexity use cases. My eyes glaze over when I read long stored procedures that someone else has written. Any recommended resources to go from beginner/beginner-intermediate to advanced?

I feel like stored procedures and co crosses over into the realm of application programming, and while I can't speak from experience (so take this with a huuuuge grain of salt), this is where things break down. It feels like adding logic / basic programming to JSON/YAML, which are data/config languages primarily.

I think stored procedures - or anything that goes beyond storing / looking up data - had a place when a database had multiple different clients, but with modern day systems that's less likely to be an issue.

Re: Learn SQL Once, Use It for 30 Years

#43
post #37
post #30

> If you are a junior developer, “learn SQL properly” is the most valuable 40 hours you can spend. Not a tutorial. Not an ORM. Actual SQL: joins, subqueries, window functions, query plans. That investment pays you back at every job, in every stack, for decades This is the power of low-level reasoning. Today, even for a junior developers, even if they have AI that solves syntax problems, SQL teaches you to reason and…

A couple of sites worth checking out to level up, both by Markus Winand: https://modern-sql.com/ https://use-the-index-luke.com/

also a few different para-sql languages that can be useful, to lower the complexity:

- https://prql-lang.org/ - https://www.malloydata.dev/

Re: Learn SQL Once, Use It for 30 Years

#44
One of the best things that happened to me is my boss giving me a crash course in advanced SQL at my first job. In the database we used at work, he gave me increasingly difficult questions to answer with queries.

It was a great foundation and has served me well to this day.

Re: Learn SQL Once, Use It for 30 Years

#45
Alternatives come and go, SQL stays.

It's not that I like or dislike SQL, it is just that it has such raw power and mature tooling/resources, I wonder what an alternative could even offer me.

It's like C. It does such a great job at being structured assembly that it is hard to displace it for similar reasons.

Re: Learn SQL Once, Use It for 30 Years

#46
post #30

> If you are a junior developer, “learn SQL properly” is the most valuable 40 hours you can spend. Not a tutorial. Not an ORM. Actual SQL: joins, subqueries, window functions, query plans. That investment pays you back at every job, in every stack, for decades This is the power of low-level reasoning. Today, even for a junior developers, even if they have AI that solves syntax problems, SQL teaches you to reason and…

>, SQL teaches you [...] Without any wrapper masking low-level logic.

I understand the point you're trying to make, and yes, it does seem like SQL is "low-level" from the perspective a wrapper like ORMs or a GUI db browser tool with menus for filtering data.

But it's also worth remembering that SQL itself is a high-level wrapper that hides the lower-level C/C++ code of the db engine that has the loops that iterate through b-trees, 8k data pages, memory blocks of the buffer cache, etc.

And C/C++ itself is a high-level wrapper that hides the logic in lower-level Linux o/s system calls that manages RAM and disk i/o.

And Linux itself is a high-level wrapper that hides low-level device drivers like SATA/SSD memory-mapped IO ... and so on and so on.

Depending on the type of app, you can ignore all the lower levels and just work at the abstraction level of higher-level wrappers.

Re: Learn SQL Once, Use It for 30 Years

#47
I think the pretext of this articles is ridiculous.

Yes, SQL is based around relational algebra, but all programming languages are built on a theoretical foundation.

And SQL is very much a "fad" language - it just somehow managed to stick around. The goal was not some sort of mathematical purity, but rather to built a natural language data interface (sounds like something currently very hyped?) and it failed spectacularly at that goal.

It is so far from natural language that English speakers with statistical understanding won't be able to read it, but it is also inconsistent enough in its grammar design that it is unreasonably difficult to learn and needs large refactoring every time you want to query into the result of a query.

To continue my rant: Sometimes '=' is an identity test, sometimes it is `==`. Sometimes groups are called groups, sometimes they are partitions.

When creating a CTE, you put the name before "AS", but when creating a column, you put the name after "AS".

SQL is great because it is everywhere and it is definitely good enough, but it is not something great, that transcends other programming languages.

Re: Learn SQL Once, Use It for 30 Years

#48
> The Only Programming Language Built on Mathematics, Not Fashion

Had to reread the title again since I thought I opened a different article about TLA+.

As for SQL, if you're referring to DBMS systems, here's what E.F. Codd, inventor of relational algebra, had to say about them and the departure from his work: https://thaumatorium.com/articles/the-papers-of-ef-the-coddf...

Re: Learn SQL Once, Use It for 30 Years

#49

I refuse to learn SQL. I'm not a computer, I'll let them deal with that.

SELECT excuse FROM ignorance ORDER BY snobbery DESC LIMIT 1;

Love it! I am speaking as someone who has used SQL for over two decades with very good success. I find it extremely logical and a good fit for my mental model. Long live SQL!!
Post reply on HN