11 ms·
Learn SQL Once, Use It for 30 Years
- teleforce 5mo ago>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 per second with D4M and Accumulo more than a decade ago back in 2014 [3]. [1] D4M: Dynamic Distributed Dimensional Data Model: https://d4m.mit.edu/ https://d4m.mit.edu/ [2] Mathematics of Big Data: Spreadsheets, Databases, Matrices, and Graphs: https://direct.mit.edu/books/monograph/5691/Mathematics-of-Big-DataSpreadsheets-Databases https://direct.mit.edu/books/monograph/5691/Mathematics-of-B... [3] Achieving 100M database inserts per second using Apache Accumulo and D4M (2017 - 46 comments): https://news.ycombinator.com/item?id=13465141 https://news.ycombinator.com/item?id=13465141
- l1ng0 5mo agoI feel you missed the point of the article :)
- kibibu 5mo agoI feel like the point of the article was "hey chatgpt write me an article about SQL"
- ndsipa_pomu 5mo agoSounds interesting, but how can I use it to talk with an Oracle/MySQL/PostgreSQL database?
- molf 5mo agoThere is no SQL successor: SQL is here to stay. Applying the Lindy effect [1]: after half a century of SQL we can expect it to survive for at least as long. Disruption/displacement of SQL is like attempting to replace email. It's not going to happen. At best an alternative technology can carve out a small niche (and there's nothing wrong with that). [1]: https://en.wikipedia.org/wiki/Lindy_effect https://en.wikipedia.org/wiki/Lindy_effect
- Hugsbox 5mo agoThat wikipedia article was super interesting, I'd never heard of the Lindy Effect before. A bit difficult to wrap my noggin around but really fascinating to think about.
- nkmnz 5mo agoRead the books of Nassim Taleb. They are full of this kind of interesting stuff. Sadly, he blocked me on twitter back when I asked him why he had a paid subscription for a self-described communist hardcore-Putinist hardcore-Antisemite :/
- dsatrainer 5mo agoNever heard of the Lindy effect either, learn something new from this site every day haha
- jppope 5mo agoIt was made famous by Nassim Nicholas Taleb in Incerto.
- democracy 5mo agoThe power of SQL is not because it is "based on mathematics" - it's because anyone (really, anyone, even with the most basic English skills) could understand it quickly enough to start using it productively with not much technical knowledge. Business analytics, managers of all sorts, manual QA people could grasp the basics in a minute and more complex queries within a few hours. It is very user-friendly and such tools win over anything else. Each time I see an overengineerd/overcomplicated solution that is hard to read/understand - I know it's only "good luck" to the creators.
- red_admiral 5mo agoThe only one? As opposed to ... Haskell, LISP/Scheme in the original SICP version, and proof assistant languages like Lean.
- aargh_aargh 5mo agoFirst impressions assuming the goal is to replace the incumbent SQL. Haven't seen the language yet. * D4M rolls off the tongue * Make me buy a book to see the language.
- olejorgenb 5mo agoThe source code is published [1] and there are MIT course videos available [2] (albeit 9 years old...). The source code appear to be primarily in Matlab(!) though. [1] https://github.com/Accla https://github.com/Accla [2] https://ocw.mit.edu/courses/res-ll-005-mathematics-of-big-data-and-machine-learning-january-iap-2020/resources/d4m-session-0-lecture-1/ https://ocw.mit.edu/courses/res-ll-005-mathematics-of-big-da...
- abtinf 5mo agoThis seems like just another NoSQL db, but with fancier words.
- trgn 5mo agoi'm probably pretty dumb but i don't really get what's so mathematical about sql.
- layer8 5mo agohttps://en.wikipedia.org/wiki/Relational_algebra https://en.wikipedia.org/wiki/Relational_algebra
- pimlottc 5mo ago> >The Only Programming Language Built on Mathematics, Not Fashion Fortran would like a word. The name literally means "Formula Translation"
- lanycrost 5mo agoI've played once with codesignal to pass SQL chapters and it really helped to advance querying skills.
- WA 5mo ago- I recently read that most programmers SQL knowledge is outdated by 20 years and it’s true for me. There are quite a lot of features in most DBs that feel very "new" to me. - Comparing SQL to React weakens the argument. SQL is the language, React is a piece of software. You certainly can run 30 year old JS today in modern browsers.
- kigiri 5mo agoAgreed on both point, I think you underlined pretty well what was bugging me with the article !
- veqq 5mo ago> Edgar Codd formalised relational algebra in 1970. SQL sits on top of it as a declarative interface. You describe what you want. The database engine decides how to get it. The engine improves every year. Your query stays the same. Although SQL is of course not relational Algebra (and others like Datalog and D4M are better), it's still cool. It inspired kSQL like Lil uses https://beyondloom.com/decker/lil.html#lilthequerylanguage https://beyondloom.com/decker/lil.html#lilthequerylanguage , which inspired the code I'm most proud of: https://codeberg.org/veqq/declarative-dsls https://codeberg.org/veqq/declarative-dsls A common query language, a common idiom, for many data structures (arrays, hashmaps, datafremas) is liberating, permitting you to e.g. solve sudoku, make mandelbrot sets or calculate primes directly: (def n 40) # to reach primes up to, left is sqr of n, right n/2, then multiply them for rows (def composites (df/select :from (range 2 (+ 1 (math/floor (math/sqrt n)))) :cross (range 2 (+ 1 (/ n 2))) :where |(<= (* ($ :value_left) ($ :value_right)) n) [[:value_left :value_right] :value |(* ($ :value_left) ($ :value_right))])) (df/select :from (range 2 (+ 1 n)) :exclude composites) Or e.g. (import declarative-dsls/dataframes :as df) (def people (df/dataframe :name :age :job)) (df/dataframe? people) (df/insert! {:name "Bob" :age 30 :job "Developer"} :into people) (df/insert! {:name "Alice" :age 27 :job "Sales"} :into people) (df/update! :set {:job "Engineer"} :where |(= ($ :job) "Developer") :from people) (df/save-csv people "people.csv" :sep "\\t") (def people2 (df/load-csv "people.csv" :sep "\\t")) (-> people2 df/dataframe->rows df/rows->dataframe df/print-as-table) The tests file has many such things (like the sudoku solver) and even datalog and minikanren implemented on top of this!
- andersmurphy 5mo agoDatalog is the dream. But SQL with a good query builder like Clojure's honeysql is not so bad. That and SQLite seems to be able to scale to almost any problem, is disgustingly fast and with litestream incredibly resilient.
- lioeters 5mo agoFascinating stuff! It's the second time I see D4M mentioned this week, and I remember seeing Lil as the little language for Hypercard-like Decker but didn't know about it as a query language. Declarative DSLs, I just started browsing the project and the code is beautiful. I've been curious about Janet for a while now, I plan to set aside some time to explore this.
- curtisblaine 5mo ago> JavaScript is an imperative language that browser wars, framework trends, and open-source maintainer preferences reshaped every few years. It rewards you for keeping up. > Take a React component from 2015 Javascript is actually fully backwards-compatible, to not break the Web. Any javascript from 10 years ago works in the browser. This is good but also a bit of a burden, since the language can only expand but not shrink. React is a library, and like all libraries it has breaking versions. Not understanding the basic difference between the two kinda undermines the credibility of the article. Also, in a similar way, core, ANSI SQL is largely backwards compatible, but all the SQL dialects linked to various DBMS implementation are generally incompatible. Obviously that's not mentioned in the article. > Not a tutorial. Not an ORM. Actual SQL: joins, subqueries, window functions, query plans. Not text written by a human. Not a style that an real writer would ever use. Actual AI slop: Short sentences. Incorrect facts. Not X, Y.
- llbbdd 5mo agoAn article laser-targeted at HN's front page, making tantalizingly negative and easily disprovable claims about Javascript? Perish the thought.
- kibibu 5mo ago> Not a tutorial. Not an ORM. Actual SQL: joins, subqueries, window functions, query plans. My brain absolutely checks out when I read this stuff now. Not to mention that query plans are absolutely not "actual SQL".
- NetOpWibby 5mo agoI refuse to learn SQL. I'm not a computer, I'll let them deal with that.
- themafia 5mo agoSELECT excuse FROM ignorance ORDER BY snobbery DESC LIMIT 1;
- wandering-nomad 5mo agoLove 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!!
- esafak 5mo agoWhat's your job title?
- frollogaston 5mo agoEveryone 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.
- bob1029 5mo agoI 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 you won't believe it loaded anything at all. Set operations allow for you to bring this newly loaded data to visibility in production tables nearly instantly. Your OLAP & OLTP workloads should be dominating the compute. ETL ops (loading/set ops) should be a ghost in terms of cpu time and memory. None of this is vendor specific knowledge. Every major engine has a reasonable way to bulk load and perform quick merging of records.
- frollogaston 5mo agoWell yeah they should've banned ORMs in the Geneva Convention. Quickest way to irreversibly ruin your schema design and backend code.
- evdubs 5mo ago> 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.
- efromvt 5mo agoThere's always a bulk insert, but I wouldn't say every engine has always had a reasonable way to bulk load truly large data... parquet really helped with interop but before that when your best option was a CSV and bcp life was not fun.
- deepsun 5mo agoJust, for god's sake, move SELECT after GROUP BY, I beg you.
- SoftTalker 5mo agoCurrent structure makes sense to me. SELECT .... what do I want FROM .... where is it WHERE .... what filters do I want to apply GROUP BY .... how do I want it aggregated Maybe it's just that I'm so used to it. I could see FROM being first, that would actually make a little more sense to me.
- efromvt 5mo agoA pretty common request is to lift the FROM up before the select, like the below. I'm pretty fine with status quo since my mind is usually "hmm what do I need to get" first, then I figure out how to get it, but some engines (duckdb, I think?) support both so everyone gets their cake. What people often want: <where to get data from> <what I want from it> <how it's filtered> <how it's grouped> <how it's filtered post group>
- anonymars 5mo agoAlso helps with autocomplete, which is why LINQ starts with `from`
- deepsun 5mo agoLinq took that from Hibernate in believe. But in general, I'd say almost all ORM and SQL-gen libraries have FROM first, because it's clearer for programmers.
- anonymars 5mo agoHibernate puts SELECT last if requesting only specific properties? LINQ: var query = from e in entities where e.property1 == value select e.property2;
- meszmate 5mo agoI’ve been using Postgres for over 6 years (since I started), and I honestly think it’s one of the best investments you can make as a developer
- ivolimmen 5mo agoSame can be said for learning an OO programming language or a procedural programming language. I learned C++ at school and started using Java on my first job. I forgot how to work correctly with pointers but I have tried multiple languages (using the same paradigms) and managed to build working software
- ciconia 5mo agoI'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.
- grebc 5mo agoOnce 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.
- gonzalohm 5mo agoThe code is simple to maintain until the database changes. Then you will experience the pain of SQL
- grebc 5mo agoI’ve experienced what you’ve mentioned before, ORM or not you have issues if you’re shuffling the schema around. Cool.
- trumpdong 5mo agoIt would be great if there was a compiler that would check your SQL queries against the schema, and you could even refactor a column name to update both the schema and the queries.
- anonymars 5mo agoMicrosoft SSDT (SQL Server Data Tools), but I think it only works against Microsoft SQL Server https://learn.microsoft.com/en-us/sql/ssdt/sql-server-data-tools?view=sql-server-ver17#core-sql-server-data-tools https://learn.microsoft.com/en-us/sql/ssdt/sql-server-data-t...
- mihaic 5mo agoI'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 ORMs, and never once regretted it. And I'm the kind of person that actually likes low-level C from time to time. SQL just feels like a poor abstraction layer: either go higher or lower.
- setr 5mo agoIt’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
- asksomeoneelse 5mo agoAre we really a minority ? Feels like a lot of people just suffer in silence. Even though I dislike SQL on many levels, I would be hard pressed to find a better, widely supported alternative. I gave up writing portable SQL and just target PostgreSQL now.
- drayfield 5mo agoFor me SQL has long been the gateway to the world of development. I work in the UK non-profit sector and traditionally this kind of technical knowledge is rare, so for any team I've worked with I've built learning pathways that start with SQL before pushing out into Python, Linux, and other things. We're not exactly at the bleeding edge of current technologies, but SQL has consistently proved to be a great jumping-off point for novices who have even a passing interest in computing.
- pjmlp 5mo agoAdditionally 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.
- EvanAnderson 5mo ago> 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.
- duckmysick 5mo agoI moved from stored procedures to dbt. I find it easier to maintain and it helps me with version control, testing, and docs. Plus, since I deal with data pipelines a lot it get other goodies like lineage and auto DDL.
- vbezhenar 5mo agoThat'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.
- alexhans 5mo agoI 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-weeks/ https://pragprog.com/titles/btlang/seven-languages-in-seven-...
- trumpdong 5mo agoWell, IPv4 is obsolete.
- sophacles 5mo agoI'll believe that when I see tech companies bring up IPv6 integration before I do when setting up networking things.
- chainingsolid 5mo agoI inquired about getting a static IP(s) for a small business, and only v4 is available.... and that was this year!
- ralferoo 5mo agoPersonally, I'm not a great fan of IPv6, but this says more about your provider than anything else. Assuming you mean for a VPS, the majority of providers provide IPv6, and a good many would advertise your IPv6 prefix and route it to your box for a nominal fee. It's far cheaper to do anycast IPv6 than IPv4 because of the cost of IPv4 address space. If you actually meant on-site for a business, that again depends on your provider, but again most providers should be able to give you a static IPv6 prefix from their own range if they're able to provide you a static IPv4 address. If not, you can always tunnel IPv6 to your site.
- aledevv 5mo ago> 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?
- qohen 5mo agoA couple of sites worth checking out to level up, both by Markus Winand: https://modern-sql.com/ https://modern-sql.com/ https://use-the-index-luke.com/ https://use-the-index-luke.com/
- oulipo2 5mo agoalso a few different para-sql languages that can be useful, to lower the complexity: - https://prql-lang.org/ https://prql-lang.org/ - https://www.malloydata.dev/ https://www.malloydata.dev/
- efromvt 5mo agoA self para-sql-lang plug if you like the direction of malloy but prefer something closer to native SQL syntax. (a controversial take at times) - https://trilogydata.dev/ https://trilogydata.dev/
- CobaltFire 5mo agoI ran across https://use-the-index-luke.com https://use-the-index-luke.com organically while learning SWL recently and I've been really enjoying it. I can't vouch for it from any perspective except as an SQL neophyte but for me it has been teaching me a lot.
- jasode 5mo ago>, 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.
- dluan 5mo agowas this article secretly written by regexp
- grugdev42 5mo agoAgreed. SQL has been one of the most stable and useful skills I have. Rivalled only by Linux, shell scripts, and Cron!
- AnonHP 5mo agoI’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?
- oulipo2 5mo agoPRQL, or https://www.malloydata.dev/ https://www.malloydata.dev/
- thelastgallon 5mo agoYaml?
- Cthulhu_ 5mo agoI 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.
- fauigerzigerk 5mo agoThe way to learn advanced SQL is to challenge yourself to find a set oriented solution and avoid procedural code. The more unreasonable it feels, the more you learn. If the solution you find is longer and not much faster than the procedural alternative, you throw it away and fall back on procedural code. Stored procedures are not advanced SQL. Most of them are not SQL at all. There are a few legitimate reasons for using SPs such as reducing roundtrips to the database and writing little pure functions for use in SQL statements. But many uses of SPs are just laziness or a symptom of organisational dysfunction.
- dust-jacket 5mo agoMy advice is: don't write complicated SQL. The best thing I learned about SQL is that it can do an awful lot of clever stuff but that the vast majority of the time you really don't need it. Learn the basics. Shrug the rest off.
- einpoklum 5mo ago> SQL is the only programming language SQL is not a programming language. You do not write programs in SQL. It's a declarative language (or set-of-sublanguages). > a working developer can learn once and > use for 30 years without rewriting their mental model. There is any number of long-living languages which satisfy this. Plus, SQL it's not even really a single language, because the spec changes, and is huge, and few people know it fully; and the dialects have non-trivial differences; and if you switch DBMSes, you often switch SQL dialect. In that sense, it is very much like other programming languages which evolve, like C++ or Fortran or even C.
- alper 5mo agoOne 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.
- glimshe 5mo agoAlternatives 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.
- wodenokoto 5mo agoI 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.
- flossly 5mo agoI found PRQL[1] to be good fix for nearly everything I dont like about SQL. But then it's only a query lang (DDL you still do in SQL then I guess). Bottom line for me now is that I dont write much of my SQL by hand. AI does a much better job at it. I just read it back and point out mistakes and/or inefficiencies. 1: https://prql-lang.org/ https://prql-lang.org/
- heisgone 5mo agoThis looks somewhat similar to LINQ in how it order clauses.
- fauigerzigerk 5mo ago>Yes, SQL is based around relational algebra, but all programming languages are built on a theoretical foundation. While true on some level, I don't think this is a very useful statement. The importance of mathematical foundations lies in the extent to which they constrain the features of a programming language. That extent is not the same for all languages. Many programming languages do not appear to be constrained by anything other than some pragmatic hunch of their designers plus the theoretical limits of computability. SQL is a mess. The author acknowledged that. But the relational model and relational algebra are more serious attempts at creating a small but expressive theory than many of our mainstream programming languages.
- gobdovan 5mo ago> 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-coddfather-codd/1988-fatal-flaws-in-sql/ https://thaumatorium.com/articles/the-papers-of-ef-the-coddf...
- Ozzie-D 5mo ago[flagged]
- notlibrary 5mo agoIt's broken expression to update karma brings downvotes UPDATE users SET karma = 9001 WHERE name='notlibrary';
- sdevonoes 5mo agoBut you cannot learn it “once”. You need to continuously use it (over those 30 years, for example) to be proficient at it. It’s not that you can study sql for let’s say, 30 days, and never touch/study it again. I did “learn” sql at uni… but had to study it again at every company i worked for (different problems triggered different solutions). Im still learning it.
- cloverich 5mo agoThat hasn't matched my experience. I read a fundamentals book on it, fully; a practical one (think it was T-SQL fundamentals, which was 90% ANSI sql). I did the problems, some were hard. Then its just kind of stuck around in my head, now nearly 15 years later. I use it often and am continuously shocked to understand it better than some of my colleagues, still, since I rarely use it. It also seems to have infected how I think, such that I'm often thinking in terms of SQL (or I guess, set theory really) when I"m reasoning about data and processing it. That's likely why it sticks, its just not that far removed from the operations that are happening (at the basic level), and then also not that complex. You aren't making new abstractions or layers with it, its a pretty limited set of features ultimately, and generally speaking it changes little if at all over time. Its great in that way, especially in this everything-changing-constantly industry.
- isabellehue 5mo ago[flagged]
- Hugsbox 5mo agoWell-designed purpose-built tools stand the test of time. When you need a hammer you need a hammer. I learned to swing a hammer a very long time ago, and that skill has stayed with me on modern-day hammers - I didn't have to learn the New Way Of Hammering Things.
- Azadeh5 5mo agoLearn Cobol once, use it for 100 years :-D
- TonyAlicea10 5mo agoI’d say the most impactful thing is not to learn SQL, but set theory. Well-written SQL is about thinking in sets. I cannot tell you how many poorly written procedural stored procedures I’ve replaced with a single performant SQL query over the years. This is because the most impressive part of the SQL ecosystem is the DBMS engine’s query plan. Though, yes, you have to know how to influence it. I find ORMs also tend to keep devs thinking procedurally. Yes learn SQL! But don’t just learn the syntax. Learn the underlying mathematical models and ways of thinking that SQL supports implementing.
- Rendello 5mo agoI think I had a pretty good understanding of set theory through programming, and although I tried to get into the more mathematical side of it, I found most things to be 1. trivial (because I was used to thinking in lists, sets, hashmaps, etc.), or 2. irrelevant to me. The latter was a shame, because I've always liked the abstraction of math, but I couldn't help but feel I wasn't learning anything actionable when learning more about sets (though maybe I'm wrong). What had a big impact on me was the relational model, specifically after reading Richard Fabian's Data-oriented Design book [1]. I had watched Mike Acton's famous Data-oriented Design talk [2], then Andrew Kelley's talk [3] where he explains speedups in the Zig compiler using DoD principles (largely using methods from Acton's talk), but Fabian's book tied these concepts to database normalization and the relational model. Most DoD advice is very "exercise left to the reader", because it's about matching a specific problem, but using the relational model and considering your data's primary and foreign key relations can be really powerful. I just wish more of that power was exposed through regular programming language interfaces, rather than having to pull in and marshal data through a DB. I might have to try C# and Linq. 1. https://www.dataorienteddesign.com/dodbook/ https://www.dataorienteddesign.com/dodbook/ 2. https://www.youtube.com/watch?v=rX0ItVEVjHc https://www.youtube.com/watch?v=rX0ItVEVjHc 3. https://www.youtube.com/watch?v=IroPQ150F6c https://www.youtube.com/watch?v=IroPQ150F6c
- TonyAlicea10 5mo agoRelational model too, yes. But the biggest "aha" moments I've had mentoring devs on thinking in SQL came when they understood that the result of a query is itself a set. So you can join two selects, join that result with another select, then group on the whole thing. Those kinds of patterns would often replace manual loops in stored procedures and opened up set theory-focused way of thinking. These patterns are made more performant and easier with good relational modeling, of course.
- ErroneousBosh 5mo agoHaving been working with computers professionally for almost 40 years now I've seen quite a lot of things come and go. I'm not convinced that LLMs will stick around for that long although they're currently doing better than "fuzzy logic", which is what it used to be called when they could run on 68HC11s ;-) You know what has stuck around though? Thumping great Unix boxes running SQL databases. Yes, there's a lot wrong with the whole concept, but everything else is in some important way worse.
- mightyham 5mo agoThe comparison with JavaScript as an exemplary imperative language is silly. You can find examples of C code from 40 years ago that still work perfectly with modern compilers. Like C, SQL is a technology that has far outlived its usefulness, though, for very different reasons. SQL was not designed for application development, and every attempt to integrate it into higher level programs (ORM, fluent query builders, raw strings, macros/preprocessors) comes with unpleasant rough edges. The best thing young developers can do is read a book like "Designing Data-intensive Applications" and learn how the fundamental technology behind databases work. Learning relational modelling is great, but learning SQL itself, unless you actively have to work with it, is a waste of time.
- onlyrealcuzzo 5mo ago> Learning relational modelling is great, but learning SQL itself, unless you actively have to work with it, is a waste of time. What a wild statement. SQL is one of the most useful tools ever developed, as evidence that it's BY FAR the most widely used programming language in the world. The idea that it is an ABSOLUTE LAST RESORT that should never be used unless you ABSOLUTELY HAVE TO is insane...
- HelloNurse 5mo agoEven wilder: > SQL was not designed for application development, and every attempt to integrate it into higher level programs (ORM, fluent query builders, raw strings, macros/preprocessors) comes with unpleasant rough edges. Forgetting that interactive SQL queries, and to an even greater degree the underlying databases, are applications.
- onlyrealcuzzo 5mo agoAnyone who hates SQL typically is completely clueless how hard it is to actually do what SQL does correctly and efficiently. SQL makes doing something that is VERY hard stupidly easy.
- 5mo ago
- mexicocitinluez 5mo ago> Now try this experiment with the JavaScript ecosystem. Take a React component from 2015. React.createClass, mixins, componentWillMount. It doesn't just look old, it throws TypeError: React.createClass is not a function the moment it loads. You rewrite it from scratch to ship it today. Ten years passed, and the framework cycled through three different mental models in that time. Pretty absurd comparison. SQL is a language, React is not. SQL has been around for over 30 years, React has not. This is what I refer to as React Derangement Syndrome. > JavaScript is an imperative language that browser wars, framework trends, and open-source maintainer preferences reshaped every few years. It rewards you for keeping up. > SQL rewards you for sitting still. Again, this is apples and oranges. These technologies are in far different places in their history. JavaScript that worked 20 years ago still works today. You can write an article about how great SQL is without having to bring React up. I promise it's possible.
- tancop 5mo agothe main reason i dont like sql is the way it splits your query into parts that run in a different order and you can only have one of each. thats why you need things like ctes. if it was a more "functional" language with features like let bindings it would be easier to understand (and maybe to optimize): from customers as c let orders := all(orders where customer_id = c.id) select c.name, count(orders), avg(orders.price)
- shawnhermans 5mo agoI resisted learning SQL for years. When I finally got around to learning it, I kicked myself for not learning it sooner. Sure, it has its share of jank and every DB has its own flavor, but at the end of the day you can do insane amounts of data processing using an easy to learn, although sometimes difficult to master, query language.
- nailer 5mo agoI don’t think it’s rational to flatten data. If an item contains an array of sub items which in turn contains an array of subitems, that item belongs in one place not three tables. I know those view isn’t popular, but I’ve happily used Linux, Python, virtualisation, node and Rust when they were laughed at and I’m not particularly concerned.
- deleted 5mo ago[deleted]
- reacweb 5mo agoMy first job in 1994 was using RDB, very soon updated to RDB-Oracle 6 that was very compliant with my book about sql 92. I learned SQL during my studies, so my queries based on joins naturally performed well, unlike the nested SELECT statements in the legacy code. I learned to tune performances. After that, I've encountered Oracle with its share of non-standard syntax and behavior. Now, when I build a backend (flask or fastapi), my CLAUDE.md contains "use sqlite without sqlalchemy" so that I can understand how data is accessed and check that there is no hidden query inside a loop. When the SQL queries generated by AI become unreadable, it’s a sign that the system is no longer functioning properly. In my view, SQL is a good way to maintain control over an application that is largely generated by AI.
- kopirgan 5mo agoThis is standard advise I give to any IT consultants (incl some that didn't ask for any lol). Cos I see too many of them evolving into purchasing clerks and postmen, far removed from the tech and operations. Regex, SQL, Basic linux command line tools, awk. More as job demands.
- theanonymousone 5mo agoI fully agree with the title (with reservation for "dialects"), and I believe the same can be said for JSON and Markdown, among possibly others.
- songting591 5mo ago[flagged]
- perrygeo 5mo agoLearn SQL (because it's basically the only option) but much more importantly, learn databases. Know why atomicity, consistency, idempotency, and durability matter. Understand the wire protocol and the client-server model. Do relational data modeling; think beyond databases as a dumb store. Join. Know when to normalize. Internalize indexing strategies. Think deeply about what work belongs on the database server (work that can leverage relational set theory) and what work stays in the application. Once you figure the true capabilities of databases, SQL as the language interface is a side note - about as important as the leather on your steering wheel.
- sgarland 5mo agoI agree with everything except this: > Understand the wire protocol and the client-server model. I'm a DBRE, and have locally compiled MySQL with debug symbols to step through something with gdb. I have yet to examine the wire protocol for MySQL or Postgres beyond a brief read from docs. I'm not saying it's not useful in some circumstances, but I can't think of a reason why a developer would ever need to know it.
- EvanAnderson 5mo agoI take "understand the wire protocol" to mean, perhaps, understand nature and shape of the communication between the client and the server. Here's an "understand the wire protocol" story: Years ago I dealt with a Customer's thick-client Win32 ERP application that back-ended into Oracle. They wanted to use it across a VPN. They naively thought bandwidth would be the major potential showstoppper and did measurement of bandwidth usage on their own. The app didn't throw around many bits so the Customer declared the test a success and spent the money on the VPN solution. After the VPN was implemented they were unhappy w/ the performance of the app and asked me to take a look. The application was built with individual SQL queries "bound" to many of the UI controls. Depending on what the user was doing, displaying a dialog might require 20+ round-trips to the Oracle server. The developers just assumed LAN latency and gave no thought to minimizing round trips. Web devs are used to dealing with RTT latency today, but this was another time. The devs had no sense of how the wire protocol worked and ended-up making users like my Customer hamstrung into "solutions" like Remote Desktop / VDI.
- achilleusrage 5mo agoAt my first job in 1997, I learned SQL & Relational DB design with the book "Database Design for Mere Mortals: A Hands-On Guide to Relational Database Design"
- nesarkvechnep 5mo agoAs a student I used to work as a network administrator in the summer breaks. The place had a very nice library of technical books. I had the pleasure to read "Database Design for Mere Mortals" there, in the hours when work was slow.
- kermatt 5mo agoNot quite as simple as learning it once. SQL evolves like other languages, across vendor implementations. The ClickHouse and DuckDB dialects for example extend the language with analytic options not found in ANSI SQL, nor T-SQL, Pl/PgSQL, etc. DuckDB QoL enhancements are greatly missed when not available.
- Rendello 5mo agoWhich SQL-specific QoL enhancements do you miss? I was really excited to use DuckDB for things like structs and enums, but after a while I just went back to regular SQL and used it for its other features.
- kermatt 4mo agohttps://duckdb.org/docs/lts/sql/dialect/friendly_sql https://duckdb.org/docs/lts/sql/dialect/friendly_sql
- donatj 5mo agoI frankly can't agree more. Learn SQL, learn the normal forms at least up to 3NF, profit. I took an Oracle SQL class in High School in the very early 2000s and frankly it set me up for my career, despite never having touched actual Oracle SQL I've become the go to guy at every job I've had for optimizing queries and reviewing designs. I read a book on how MySQL actually worked under the hood in the late aughts and it really went a long way towards the effort. It's really not as hard as the complexity of modern ORM tooling likes to make it seem. That scares people away. It's an elegant language for a more elegant age. I went to a talk like 10 years ago about how SQL will be displaced by Hadoop/MapReduce in the next 5 years. I posted on Twitter about it at the time like we'll see if that happens. Spoilers, it didn't. I can't even think of the last time I've heard someone invoke the name of Hadoop
- manoDev 5mo ago… and you’ll have to look up the syntax every year.
- ChiperSoft 5mo agoYeah, I actually had to learn it three times because it didn't stick until I was actually using it daily.
- Centrino 5mo ago> Learn SQL Once, Use It for 30 Years. Well, during those 30 years you'd have to learn a few additions that were added to the SQL standard, like "OVER / PARTITION BY", and maybe a few non-standard extensions like "QUALIFY". There have been 11 modifications to the SQL standard since the initial SQL-86 ANSI standard of 1986.
- jjice 5mo agoVery worthwhile additions in most cases IMO, and well worth the "continued education" required.
- Kuyawa 5mo agoI've been using SQL for almost 40 years and I know for sure I will be using it for the next 20. Relational databases is about data sets used everywhere and SQL is the math behind it. With AI it's even easier as it creates all the DB schema for me, all the dummy data to test my apps and all the complex queries needed.
- functionmouse 5mo agoHonorable mention to C89 for also being supported forever and ever
- justincredible 5mo ago[dead]
- functionmouse 5mo ago> If you are a junior developer, “learn SQL properly” is the most valuable 40 hours you can spend. "Learn SQL Properly" is referenced as if it were a book or a course, but it seems to be a hallucination? I can't find any reference to this online.
- ffsm8 5mo agoIt's ai written. The prompt likely contained the phrase hence the quotes
- darksaints 5mo agoYes yes, all fine and good. I love SQL, think it is incredible how relevant it still is as a high level language, and think it should be the basis of almost every data storage and retrieval system out there. And I love that the foundation is relational algebra, which is an extremely useful abstraction for data management. But for the love of god, get rid of the ternary logic. It is only mathematically sound to the extent that mathematicians are masochists and will try to formalize anything regardless of how painful it is for normies. Boolean logic is good enough and doesn't feel like an exercise in retroactive continuity.
- whartung 5mo agoI thought this was about me. I learned SQL 30 years ago and, well, pretty much stopped. Through the years, as we added ORMs and were using the databases more for base dumb storage, and that I ventured away from report writing, focuses more and just services, workflow and CRUD, I never really learned modern SQL. I've just been able to muddle through with the SQL I learned long ago. To the articles other point, I've been doing Java for almost 30 years, and while we have a much more modern language, the fundamentals of years ago are still sound and used every day.
- markus_zhang 5mo agoI agree with the gist, but I’m so sick of SQL nowadays — or rather, so sick of writing business logic in SQL, that I’d rather not work with it for the rest of my life. It’s ironic that I’m pretty good with it.
- simonw 5mo agoSQL and Bash/sh/zsh are the only two languages I learned at the start of my career that have stayed consistently useful ever since. (I never got very good at Bash but just the REPL terminal basics have served me very well.)
- NoSalt 5mo ago> "JavaScript and its ecosystem is an environment where browser wars, framework trends, and open-source maintainer preferences reshaped every few years." In general, I hate frameworks, and not just JavaScript frameworks. Firstly, for the reasons she describes; they do change quite frequently and break stuff. Secondly, I don't see it saving any more time than using several nice libraries. Not only do you have to learn JavaScript, Java, C#, etc. but you have to learn the framework syntax as well. I will, obviously, use a framework at work when I have to, but for my personal projects, I try to "hand roll" as much as I can with vanilla languages.
- adzm 5mo agoThis is why I like things like React and Astro, for the most part it is just JavaScript in the end. Other than JSX which is already familiar from using HTML and has applications beyond React
- boredemployee 5mo agoI remember that when I was learning SQL, I felt like I was gaining a new way, or perspective, to think about other things in life. I think you end up exercising how to structure your thoughts.
- justinhj 5mo agoMay be of interest: A Critique of Modern SQL And A Proposal Towards A Simple and Expressive Query Language. It is a critique of modern SQL and a suggestion for "SaneQL": "SaneQL features a straightforward and consistent syntax, which improves its learnability and ease of implementation. Additionally, it provides extensibility, with the added ability to define new operators that integrate seamlessly with the existing built-in ones. Unlike most data frame APIs and NoSQL query languages, SaneQL fully embraces the core principles behind SQL, especially multiset semantics." https://www.cidrdb.org/cidr2024/papers/p48-neumann.pdf https://www.cidrdb.org/cidr2024/papers/p48-neumann.pdf A colleague of mine is working on an implementation of these ideas: https://github.com/wvlet/wvlet https://github.com/wvlet/wvlet
- recursive 5mo agoStrong agreement. Also applies to regular expressions.
- kevstev 5mo agoEh... yes but, I can write a sql query and come back a year later and understand it at first glance, or maybe if its really complicated a minute or two. Writing a regex involves always looking up the syntax, and being unable to read it an hour later without having to carefully disect it. I say this with 20+ YOE and I think I am better than the average bear with them. That said, knowing what they can do is important and very useful. Its just the implementation that never quite sticks.
- recursive 5mo ago> Writing a regex involves always looking up the syntax No. I mean, I believe it does for you. I use it often enough that it's always fresh. On the other hand, I always need to look up the syntax of CREATE TABLE. My experience can be described the same as yours.
- marginalia_nu 5mo agoI think the main problem with regular expressions is that there are so many dialects that are subtly different. The same sort of goes for SQL, but it's not quite as bad as regular expressions are. (Other big problem with regexes is that they are strictly slower than handrolling the equivalent string parsing code, and kind of a denial of service hazard to boot).
- recursive 5mo agoThere's a standard base dialect of regex that works everywhere, just like SQL. SQL also tends to be slower than hand optimized data structure wrangling. If you use untrusted regex, you'll be subject to DOS. If you use untrusted SQL, you'll be subject to much worse.
- channel_t 5mo agoI also feel like giving a shout out to the PDF version of the official PostgreSQL manual. It was one of the most enjoyable and engaging tech books I've ever read, and seems like pretty much the gold standard in what official documentation can look like. It took me a while to figure this out though, because the UX of the standard HTML version of the manual is pretty clunky.
- gigatexal 5mo agoThis is so true. I’ve been making a good living for the last 15 years because I learned SQL as a junior DBA.
- jancsika 5mo ago> Now try this experiment with the JavaScript ecosystem. Wow, JavaScript ecosystem is bad! > Now try this experiment with [scrubbed] JavaScript [scrubbed]. Wow, JavaScript is great!
- tregoning 5mo agoJavascript from 30 years ago, still works today.
- deleted 5mo ago[deleted]
- thecaio 5mo agoI learned SQL when I was 13 or 14 (I'm 37 now). Fully agree with the article, but it's a shame some choices behind the syntax make it so clumsy. Some choices (minimal), like allowing "," (commas) after columns in the SELECT clause even on the last column declared would be minor in terms of compilation and a GREAT improvement in ergonomics (and composability). Some more recent SQL idioms do allow for tweaks/improvements on these, but it's far from a standard - still niche. Long live SQL.
- CommenterPerson 5mo agoI'm an existence proof of this. I learned SQL following my previous employer dying a slow death > layoffs. Having worked in a narrow field, there weren't options to continue working in it. That was 25 years ago. SQL was the foundation of a second career in business data analytics. Moderately interesting and paid the bills. I must say, it's not just select *, joins and so forth. The human side was important. Always being on the lookout in Big Corp for people hungry for data (lots of them), and working to find quick solutions.
- deterministic 5mo agoSomething I recently realized: You can think of a view as a function that computes an output table from N input tables. Kinda like how Excel works but with tables instead of cells. That is extremely powerful.
- porridgeraisin 5mo agoThe real lesson is to learn low level details once and use it forever. The advantage of abstractions that maintain backwards compatibility better than most (linux syscall, SQL, etc) is that they become low level in the sense of the above statement. There is absolutely no way most syscalls or SQL are actually low-level, but for the most part you can write your code as if they are. Of course, these abstractions do leak, but for X% of usecases, they reduce the learning required to get the same output as you would have gotten with "true" low level knowledge. The actual quality of the abstractions is completely moot, the backwards compat _alone_ means that their value exists at almost any value of X. See: the web platform, with a very low value of X. This is why I love libraries and APIs that focus on backwards compat more than most. Everything else is unknown - you don't know how high quality your API is and how it will stand the test of time. But one thing is for sure, a backwards compatible API will _always_ be useful in some capacity.
- cykros 5mo agoI'm not sure I really consider SQL a programming language though. Certainly doesn't seem fair to compare it to anything turing complete (at least, unless you're going to lump in extensions such as PL/SQL or T-SQL. Doesn't detract from the advice to learn it though. Picking up books on Perl and C as a teenager always left me feeling like I was missing something key that'd make programming more accessible, and I learned FAR later that what that was was an appreciation for making better use of structured data. In lieu of either larger data structures or microcontrollers, everything I looked at felt like a much more complicated and slightly more capable calculator; the access to large relational data models is really where the super powers of turing complete languages clicked.
- simonebrunozzi 5mo agoI absolutely LOVED learning SQL on PostgreSQL, roughly 26-27 years ago (so, close to the 30 years cited there). I think I still retain at least 70-80% of all the knowledge I built back then, and it is the case probably because the way in which I learned was by DOING.
- KellyCriterion 5mo agoAn for everyone starting fresh, I can HIGHLY recommend the SQL website: "Use the Index, Luke" https://use-the-index-luke.com/ https://use-the-index-luke.com/
- kigiri 5mo agoI love the idea of SQL but to this day after years of using it I still have a strong dislike for it. The syntax never was intuitive and still isn't, I always mix it up, I found it syntax error always a pain to debug, the tooling is all over the place. I do agree that it's a truly valuable skill and expect it to last more 30 years.