Live data from Hacker News

Learn SQL Once, Use It for 30 Years

fagnerbrack.com

21–30 of 243 posts

Re: Learn SQL Once, Use It for 30 Years

#21
post #15

I've been slowly transitioning from using an ORM to just plain SQL. It's so much simpler. Less magic, more explicitness, and more control. Also, much better performance. I think the thing is to construct your model around the different queries you need to perform. In many cases, especially a CRUD-type situation, you'll end up with 10-20 different SQL queries, and that's it.

Once you break free of ORM’s I find the code so much simpler to maintain.

Here’s the query(typically multiple different subqueries and return types), here’s the params, give me all the data back and something like Dapper in .net is an absolute godsend to convert it.

Re: Learn SQL Once, Use It for 30 Years

#22
post #20

Everyone knows SQL already. The harder parts that pay off are schema design, knowing how to interact with your DB in code, and knowing all the ins and outs of whatever DBMS you're using.

I would emphasize the importance of batching and set operations. This is where I think many developers lose track of the rabbit, because you don't have much control over either of these things via ORMs. You have to get your hands dirty with raw command text. The value of this stuff is difficult to overstate. Batching allows for you to rapidly load the RDBMS. The first few times you test, it will probably go so fast y…

Well yeah they should've banned ORMs in the Geneva Convention. Quickest way to irreversibly ruin your schema design and backend code.

Re: Learn SQL Once, Use It for 30 Years

#23
post #17

I've learned SQL around 20 years ago, and in all this time I've felt it was just a poorly designed language. It was always infuriating to write because of its verbose nature. Keywords were split into two words. I'm still shocked it's not "GROUPBY". There is no composition and modularization of logic, queries become massive expressions. I know I'm in the minority in places like this, but I've spent all my life using O…

It’s a good abstraction layer, and a fundamentally good/effecient model of organization and data management. It’s a horrible language, has a meaningless standards doc, some of the worst debugging tooling of modern system and generally any tooling outside of the RDBMS engine itself is 20 years stale.

The only difficult part in arguing this is that RDBMS != SQL != RelationalAlgebra, and it’s very often forgotten

Re: Learn SQL Once, Use It for 30 Years

#24
post #20

Everyone knows SQL already. The harder parts that pay off are schema design, knowing how to interact with your DB in code, and knowing all the ins and outs of whatever DBMS you're using.

I would emphasize the importance of batching and set operations. This is where I think many developers lose track of the rabbit, because you don't have much control over either of these things via ORMs. You have to get your hands dirty with raw command text. The value of this stuff is difficult to overstate. Batching allows for you to rapidly load the RDBMS. The first few times you test, it will probably go so fast y…

> I would emphasize the importance of batching and set operations.

Please, preach your gospel more loudly and frequently. It always feels like people complain about RDBMSs being slow because they run insert queries one at a time.

Re: Learn SQL Once, Use It for 30 Years

#25
post #19

Additionally learn stored procedures. Helps simplify complex SQL queries and no need to waste network traffic on data that client side is never going to use, and waste CPU cycles processing it. Yes, what about database portability? I am on my 50s and it only mattered on a single project, which was anyway a middleware for application servers.

> Additionally learn stored procedures.

For sure, but have a solid grounding in set theory to go with it.

I've dealt with so many poorly-performing stored procedures that ended up being written as iteration over a CURSOR when they could have been done with sets. Programmers who don't grok set theory reach for iterative constructs which, while they work fine, are an impedance mismatch with SQL.

Re: Learn SQL Once, Use It for 30 Years

#26
That's true. SQL knowledge is one of the few skills that didn't age.

1. C language.

2. *nix tools (shell and friends).

3. SQL.

4. Basic IPv4 networking.

These things I learned around 20 years ago, they didn't change much and they are useful for me to this day.

Re: Learn SQL Once, Use It for 30 Years

#27

>The Only Programming Language Built on Mathematics, Not Fashion As a modern array language D4M is the natural successor for SQL [1]. D4M is based on mathematics like SQL, specifically associative array algebra but not relational unlike SQL. It's more generic since can it caters to most modern data abstractions including spreadsheets, database tables, matrices, and graphs [2]. You can achieve 100M database inserts pe…

I feel you missed the point of the article :)

Re: Learn SQL Once, Use It for 30 Years

#28

>The Only Programming Language Built on Mathematics, Not Fashion As a modern array language D4M is the natural successor for SQL [1]. D4M is based on mathematics like SQL, specifically associative array algebra but not relational unlike SQL. It's more generic since can it caters to most modern data abstractions including spreadsheets, database tables, matrices, and graphs [2]. You can achieve 100M database inserts pe…

Sounds interesting, but how can I use it to talk with an Oracle/MySQL/PostgreSQL database?

Re: Learn SQL Once, Use It for 30 Years

#29

That's true. SQL knowledge is one of the few skills that didn't age. 1. C language. 2. *nix tools (shell and friends). 3. SQL. 4. Basic IPv4 networking. These things I learned around 20 years ago, they didn't change much and they are useful for me to this day.

I was a fan of Seven Languages in Seven Weeks [1] because it exposed you to different paradigms which you could then try to apply where they made sense on whatever tools you were using or building: prototype based, fault tolerante, funcional, logical. Very fun book when used right.

The point being that sometimes the tools themselves don't need to survive because you take the lessons from one thing to another (e.g. move semantics and rust/modern c++)

[1] - https://pragprog.com/titles/btlang/seven-languages-in-seven-...

Re: Learn SQL Once, Use It for 30 Years

#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 approach problems logically. Without any wrapper masking low-level logic.

It's something like the letters of the alphabet that form concepts: why should they change?

Post reply on HN