4 ms·
Honestly SQL screwed things up from the very beginning. "SELECT FROM" makes no sense at all. The projection being before the selection is dumb as hell. This is
by thiht 2y ago
Honestly SQL screwed things up from the very beginning. "SELECT FROM" makes no sense at all. The projection being before the selection is dumb as hell. This is why we can’t get proper tooling for writing SQL, even autocompletion can’t work sanely. You write "SELECT", what’s it gonna autocomplete?
PRQL gives me hope that we might finally get something nice some day
- akira2501 2y agoSELECT 1+2; FROM clauses aren't required, and using multiple tables in FROM doesn't seem to work out too well when that syntax is listed first.
- yen223 2y agoWITH clauses are optional and appear before SELECT. No reason why the FROM clause couldn't behave the same
- akira2501 2y agoIsn't that strictly for CTEs? In which case, you are SELECTing from the CTE.
- ElectricalUnion 2y agoBeginning with Oracle Database Release 23 [released May 2, 2024], it is now optional to select expressions using the FROM DUAL clause.
- thiht 2y agoDoesn’t change anything, you can still have the select at the end, and optional from and joins at the beginning. In your example, the select could be at the end, it’s just that there’s nothing before.
- gfody 2y ago> what’s it gonna autocomplete? otoh if you selected something the from clause and potentially some joins could autocomplete
- thiht 2y agoNot reliably, especially if you alias tables. Realistically, you need to know what you’re selecting from before knowing what you’re selecting.
- parpfish 2y agoI also hate having SELECT before FROM because I want to think of the query as a transformation that can be read from top to bottom to understand the flow. But I assume that that’s part of why they didn’t set it up that way — it’s just a little thing to make the query feel more declarative and less imperative
- scrlk 2y agoThe initial version of SQL was called "Structured English Query Language". If the designers intended to create a query language that resembled an English sentence, it makes sense why they chose "SELECT FROM". "Select the jar from the shelf" vs. "From the shelf, select the jar".