Learn SQL Once, Use It for 30 Years
fagnerbrack.com
fagnerbrack.com
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?
I can't vouch for it from any perspective except as an SQL neophyte but for me it has been teaching me a lot.
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.
I'd say SQL is a very high level language.
"SQL teaches you to reason and approach problems logically" -- I kind of agree here. It teaches relational data mgmt. I think it is better to attack most software design challenges at a higher level, and --once settled at that level-- consider how to "serialize" those solutions to an RDBMS (if that's the tech that you've chosen for persistence; still a very solid choice after 50+ years!).
In my experience, SQL sorely misses sum-types. So I need to find a way to serialize the sum-types of my domain model to SQL.
They tried teaching us this relational algebra (or whatever you call it) in university but most of it went over my head because it was too abstract. Using weird mathematical symbols. But when we started writing actual SQL, all of that made sense to me.
I think it might be easier to see it in action and then go back and understand the fundamentals of how/why it works.
SQL is still very useful after all these years: that's the point that anyone will agree on.
Not low level. Not "fundamental" (by most definitions I can think of).
Yes indeed. When I learned SQL in college, the professor made a HUGE deal about how it was a "4th generation language" so it was so abstract you didn't have to think about how the computer would answer your query.
Even at that time I thought that was massive overstatement of what using SQL was like. It didn't deliver on that promise very well. But it's very funny to see plain SQL now sometimes called "low level"!
If you see SQL where someone wrote a SELECT and is then using a cursor to loop through those results and do other queries, you've found the person who is still thinking imperatively.
The quote that comes to mind: "His pattern indicates two-dimensional thinking."
> I've done far worse than kill you. I've hurt you. And I wish to go on hurting you.
Which I believe is a paraphrase of the Oracle Master Agreement.
Prolog teaches logical constraint based thinking.
ML/Lisp/etc teach functional thinking.
There is a lot of use in learning these other things beyond the standard imperative thinking from C/Python/Java/etc. Since some problems reduce their complexity significantly in one form or another.
To a first approximation, yes. But 'client-side joins' can be a valuable tool when the database engine won't cooperate. For some queries and some engines, you can do a select with a join to get everything you need in one query, but a select to get a list of ids followed by a union of selects (not an IN query) to get details for each id will have the results at the client sooner, with less load on the database, at some potential loss of consistency. Your client needs to be within a reasonable round trip of the server or the two queries approach won't get the answer faster.
Same with UNION vs IN. If you union 10 queries for one row each by id, it'll hit the index every time; but if you do it with IN, maybe it decides to do an index scan which takes longer.
You could say well the database engine is broken if client-side join works better than database-side join, and sure it probably is, but given the choice of fix the database engine or do a client-side join, I know which one is feasible in the short term.
Worst case, you could CREATE MATERIALIZED VIEW whatever would've happened in that temp table.
At the end of the day, your single query will be faster.
Every major database uses nested loop, hash, or sort-merge joins. If the data is small enough to fetch in a second query, I don't see any scenario where it would make a query spill to disk when it otherwise wouldn't have (except those pesky OR's).
Most JOIN issues can be resolved by composing using sub-queries/CTE's to defer a join to a smaller intermediary result, and the only time this generally can't be done is if you need a predicate on the joined table.
> you've asked the database engine to sort things
I've only found this to be true when there's an OR condition where the single query ends up doing a bitmap against every row, in which case a UNION will be faster since it's just appending two already-index-ordered streams.
> Same with UNION vs IN
A union is almost always going to be worse - most query planners cannot optimize across queries in a UNION, so each query is going to have separate ops vs. a single op with the IN. The only case I've seen this be true is for multi-column predicates with an OR clause against a composite index. I just tested the former in both Postgres and MSSQL and the UNION query cost was 2x the IN clause.
> maybe it decides to do an index scan which takes longer
This has not been my experience unless the table statistics are bad.
ah, this is an Ai article
Funny thing is, that is always argument of „anti ORM” people.
I yet have to see someone actually argue that you don’t need to understand SQL and ORM will suffice in the wild. Then also find devs who can’t do a simple join as joins and index usage is not some black magic and is still required to use ORM properly.
Well that's because decades of bitter experience has told us all that object graphs rarely map cleanly to sets of relationships.
However, I do think that must have been the original idea as tools such as Hibernate tried so hard to obscure the underlying SQL and database. As a result all Hibernate objects have their own particular identity requirements which only made sense to a developer that knows what's going on under the hood.
Like an early article having headline "ORM will replace SQL knowledge".
I am professional dev for 15 years and hobbyist for 20 years and I might have missed something. But only thing I do remember was "anti ORM" people nagging how "one should really know SQL" - where I never heard anyone saying "don't learn SQL" maybe only NoSQL hype... but no one else.
Yes, LLMs overuse that pattern. But it's a valid rhetorical device used for many , many years by human authors. Quite often too, especially in philosophical writing, and fantasy novels.
I'll give you that it wasn't often used in blogs or tech articles, but LLMs have been around long enough to have influenced human writing in other domains without the entirety of the content itself being LLM generated.
But its called out so often I swear people online will go read some classics and accuse them of being AI generated.
She stopped using that name.
I'm skeptical. Give us an link to something you wrote prior to 2022.
GPTzero says there's a 0% chance of that being AI written.
So, no, people have not "always written like the way AI writes now".
From the quoted snippet from the original article, purportedly AI-generated:
> Not a tutorial. Not an ORM. Actual SQL
From my comment:
> Not stock options. Do not gamble, your life is passing you by.
> Not titles, unless you have a clear plan to leverage your title into a better paying job.
> Not "job safety" - it is never safe. You being in an in-demand area is your job safety.
You can check for yourself on any of the GPT checkers - they're completely different (I saw the difference too)
I'm by no means a senior dev, but I don't know if I fit in the box of a junior either.
Regardless, SQL is proving enjoyable. But I really like logic, so it fits.
And indexes. Many times in my career, adding the right SQL index has solved a serious performance problem.
It is valuable and critical in lots of real situations. But it may interfere with the actual learning.
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:
[2] Mathematics of Big Data: Spreadsheets, Databases, Matrices, and Graphs:
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):
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).
* D4M rolls off the tongue
* Make me buy a book to see the language.The source code appear to be primarily in Matlab(!) though.
[2] https://ocw.mit.edu/courses/res-ll-005-mathematics-of-big-da...
Fortran would like a word. The name literally means "Formula Translation"
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.
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/
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.
> 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.
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.
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.
Cool.
https://learn.microsoft.com/en-us/sql/ssdt/sql-server-data-t...
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.
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-...
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.
Doesn't mean it stops working or being useful, and in arguably IPv4 case it is still of far more importance than v6.
Probably depends a lot on a particular location.
- 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.
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 , which inspired the code I'm most proud of: 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!That and SQLite seems to be able to scale to almost any problem, is disgustingly fast and with litestream incredibly resilient.
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.
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.
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.
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.
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.
Probably because - despite it not being perfect - the only people who have been able to do it better are very slight variations of it like LINQ and Logica and GoogleSQL etc.
I agree with you in terms of syntax, though, it leaves something to be desired. But learning SQL was a pretty fundamental step in my journey to becoming a data scientist. It helped form the basis for how I reason about tabular data.
Eh... Where did you find `==` used in SQL?
SELECT 2==2
But maybe that’s on them and not on SQLWe're kind of stuck with it, unless someone does for SQL what Kotlin tried to do for Java. I wonder what it would even look like, or if the real answer is to take the WASM spec, and make one for SQL itself, so you can write queries in any language, compile them to "WASM-DB" or whatever, then those get converted over to standard SQL, until databases support "WASM-DB" or whatever language.
Would love to see what something like this could look like and if it would be worthwhile? For me WASM opens us up to not having to write front-end JS and being able to do front-end and back-end both in your native programming language (like Blazor does for C#).
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.
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.
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.
I understand that SQL is pseudo-relational, but it’s as good as you’re going to get if you want something you can use for actual workloads.
The relational model is superior as complexity grows (although arguably the deductive model is even better), but the tablational model is superior for simple line-of-business stuff, so pick your poison. Like with all things engineering, there is never one perfect solution that satisfies everything. If, like the earlier comment suggested, you keep your SQL simple then you'll be fine.
I find those big stored procedures usually fall into two categories; logic that should be in the DB, but should be decomposed (staging tables, other SPs, etc) in which case they can be understandable in chunks; or logic that shouldn't be in the DB but has been shoved in there, in which case there's more of an ideological debate but I generally prefer to pull out and run in the application layer. (the latter is pretty much IMO the things that you've done after you've gotten the data at the right grain, when you are massaging it to a particular form/presentation format; performance is often the final arbitre here though).
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...
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.
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.
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...
> 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.
SQL makes doing something that is VERY hard stupidly easy.
I'm well aware of the underlying challenges that SQL provides convenient abstractions over, and what I'm saying is that it actually isn't all that helpful for complex use cases unless you know a decent amount about dbs; which at that point, I'd rather program against a thinner , less abstract persistence API.
The flip-side of what you've stated is that SQL makes doing things that that SHOULD be hard, because they are stupid, stupidly easy. For instance, it's dead simple to make read queries with complex filters that join together an arbitrary number of tables and transactional updates that change values in rows across multiple tables. However, on large datasets or application that need high throughout, relying on those kinds of queries would be a terrible idea.
Furthermore, databases like Postgres use SSI by default which means that complex transactions that mix reads with writes can have subtle and hard to catch bugs that are completely non-obvious to new comers. I could easily forgive a junior developer for thinking they could implement an accurate counter in postgres using a transaction with a select then update to increment a value in a given row.
Sqlc is the best thing I've personally used because it produces models and repositories based on plain sql queries.
It's almost as if it was easy to reinvent something highly used that someone would've already done it...
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.
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.
I have seen DBAs make wonders without changing queries, only by adding the right set of indexes.
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.
The only difficult part in arguing this is that RDBMS != SQL != RelationalAlgebra, and it’s very often forgotten
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.
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.
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.
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.
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
A colleague of mine is working on an implementation of these ideas:
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.
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.
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.
It was a great foundation and has served me well to this day.
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.
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.
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.
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.
from customers as c
let orders := all(orders where customer_id = c.id)
select c.name, count(orders), avg(orders.price)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.
My brain absolutely checks out when I read this stuff now.
Not to mention that query plans are absolutely not "actual SQL".
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
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.
Regex, SQL, Basic linux command line tools, awk. More as job demands.
"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.
"Use the Index, Luke"
(I never got very good at Bash but just the REPL terminal basics have served me very well.)
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.
I think you end up exercising how to structure your thoughts.
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.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>
LINQ:
var query =
from e in entities
where e.property1 == value
select e.property2;Personally, I disagree. In English, an imperative statement like "move that chair from the dining room to the living room" is generally verb-first (with respect to location, anyway). SQL's flow has always made perfect sense to me.
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.
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.
(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).
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.
Rivalled only by Linux, shell scripts, and Cron!
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.
It’s ironic that I’m pretty good with it.
Wow, JavaScript ecosystem is bad!
> Now try this experiment with [scrubbed] JavaScript [scrubbed].
Wow, JavaScript is great!
UPDATE users
SET karma = 9001
WHERE name='notlibrary';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.
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.
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.