I do love SQL and at least where I live (MS SQL Server) it can be made to run amazingly fast if you take some care with your queries and indexes. It's not portable though: as far as I know not a single one of the big sql vendors follows the standards 100% and more importantly, spending some time with one vendor will give you some habits that are sure to not work as well with another (cursor constructs are generally a…
Against SQL
31–40 of 354 posts
Re: Against SQL
#32Re: Against SQL
#33Idiots, idiots everywhere.
Re: Against SQL
#34You can use NATURAL JOIN
select * from foo natural join bar
Works as long as the keys are named the same. However, a lot of people have a habit of naming keys differently in the two tables.
Re: Against SQL
#35>what if we want to return the salary too? >the only solution is to change half of the lines in the query How about adding a second subquery for the salary.
It is a toy example. Perhaps imagine a more realistic subquery that is much longer. Are you going to duplicate a 50 line subquery to get the salary when all you want is one more value ? No, you'd probably want to restructure the query with a join or CTE instead. To the author's point, a large change relative to the gain.
Re: Against SQL
#36If that sounds interesting, you can find it here: https://github.com/erezsh/Preql
Re: Against SQL
#37Earlier quoted context omitted.
This example seemed wrong to me as well. You can have a subquery, or CTE that returns as many fields as you want and can join on the manager key
An additional subquery and a CTE are both restructuring the query significantly, which is the author's point.
Re: Against SQL
#38One of the elephants in the room with SQL is that it is one of a small number of popular languages that doesn't use function(arg, arg, arg) It is strange that "SELECT a, b, c FROM schema.table" keeps any aura of respectability. That is legitimately outdated syntax, people don't write languages that way any more. It was a 70s era experiment and what was learned from that experiment is that the style has no upside and…
Comparing SQL to those other languages doesn't really make sense. Their purpose is different. For what SQL does, the syntax makes a lot of sense because it is a completely different paradigm. I think it's dismissive to refer to SQL as merely a 70s experiment. It is used so widely today still
SELECT a, b, c FROM d
has over even a trivial modernisation like, say, table(d) |> select(a, b, c)
?Re: Against SQL
#39Lots of the examples here are yhe author writing very poor, non idiomatic SQL and then criticizing it. I could write a point by point rebuttal but I'll just pick one point, compressibility: VIEWs.
Re: Against SQL
#40In most CRUD's we currently have on the backend layers and layers of software with ORMS, frameworks etc, and it all boils down to "Writing/Generating the correct(good-enough) SQL"
We now have added stuff like GraphQL, which if you squint hard enough (ok very hard) can be seen as being a SQL alternative(Language to get the actual data).
Maybe SQL + "GraphQL-Like" Layers should "evolve" into ONE common "data scripting language" ?
Maybe we have something like "ClientSide-SQL" - which can be a subset of ServerSide-SQL ?
We need the "TypeScript" of "data-querying" which can be run on the server,client, moon and my device, where one can also only define any "Types" ONCE.
Anywhoo - I think there is still a lot to be done, researched and discovered in this section of CS :)