3 ms·
I am definitely in the "enough to be dangerous" category, but isn't it technically possible to write SQL queries the way you describe? IE, the only reasons to w
by smichel17 6y ago
I am definitely in the "enough to be dangerous" category, but isn't it technically possible to write SQL queries the way you describe? IE, the only reasons to write them in SELECT .. FROM order are (1) tradition / what others expect, and (2) optimizations made by the dbs that assume the traditional order? But in terms of returning correct results, FROM .. SELECT should work fine, I think.
- sumtechguy 6y agoHaving not written a SQL parser. But I would assume there is a grammar parser in there that puts the items into some IR like language or structure that runs it. The big ones call it a query plan. So you in theory could flip them around as long as the query plan was the same. You would just need to basically convince MS and Oracle and all the other DB projects to do/try it. Not sure they would see the benefit though. In my head they are backwards but in their design it may be fine. Ideally the keywords could be in any order. But that would probably break some implicit ideas that those keywords convey (looking at you having and group by).
- smichel17 6y agoHmm, I thought I remembered reading something to the effect that this was currently possible, but now trying to find more information about it I'm coming up empty.
- sumtechguy 6y agoWith oracle if it exists would probably be a compiler directive. In MSSQL would be some sort of DBCC command. Not sure with the other DBs as I do not use them as much and have not needed to tweak them at that level.