3 ms·
The thing is with SQL is many devs seem to be in one of 3 states with it. Allergic to it, will not touch it. Enough to be dangerous, and make very bad decisio
by sumtechguy 6y ago
The thing is with SQL is many devs seem to be in one of 3 states with it. Allergic to it, will not touch it. Enough to be dangerous, and make very bad decisions with it. Amazing at it and fixing poor decisions. I am not sure what it is about SQL but it really seems to rub people the wrong way. I think it is the order of the statements. I think if they had switched the from and select statement around people would 'get' it more.
SQL is a neat tool for what it is. But command line bashing does not seem like a good fit to me. I get what you are saying though. I just would be kind of miffed to have to do something like 'select * from folders(/foldera/folderb/folderc) where lastcreatedate > getutcdate('1970') order by lastcreatedate desc' when I can currently do something like 'ls -ltar'. It is not that I can't do that. But it takes a cognitive load to do it for a command I use a lot. Of course I could make a program to do it. But then I am kind of back where I started? I could get behind SQL in addition to what I have. But in replacement I think that would be a tough sell.
- smichel17 6y agoI 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.