5 ms·
I've actually found myself more and more disappointed that FROM isn't the first clause in the query, it'd be really nice to express those queries as WITH, FROM,
by munk-a 7y ago
I've actually found myself more and more disappointed that FROM isn't the first clause in the query, it'd be really nice to express those queries as WITH, FROM, GROUP BY, HAVING, WHERE, SELECT, ORDER BY, LIMIT as that's usually the way I consider queries - granting HAVING is sort of a free card here, I don't use it enough to place it accurately, but being near WHERE or GROUP BY makes a lot of sense.
- war1025 7y agoA professor I took a databases course from in college was convinced XML was the next big thing, so he made us also learn the XQuery language [1], which does things in roughly the order you described. I don't remember the specifics, just that the acronym was something like "flower" and you started with your from clause and ended with what you would return. [1] https://www.w3schools.com/XML/xquery_flwor.asp https://www.w3schools.com/XML/xquery_flwor.asp
- iamthepieman 7y agoFLOWR - from, let, order by, where, return.
- gigatexal 7y agoOr flows just replace the r with the s for select
- kccqzy 7y agoOr rather, why have the language limit you on the order of the operations? Why can't you for example do a LIMIT and then a WHERE? This can currently only be accomplished by using subqueries. I've been thinking of developing a different query language that transpiles to SQL that allows you to more-or-less reorder these operations arbitrarily. You can easily do that in any regular programming language so why not SQL?
- wolco 7y agoAn oem is perfect for that use-case and most allow chaining of the above in any order.