The 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".
“Go to the shelf and select the jar”. You’re describing a process, so it’s natural to formulate it in chronological order.
SQL is a declarative language not a procedural one. You tell the query planner what you want, not how to do it.
I 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
SELECT 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.WITH clauses are optional and appear before SELECT. No reason why the FROM clause couldn't behave the same
Isn't that strictly for CTEs? In which case, you are SELECTing from the CTE.
Re:Pipe Syntax in SQL
by ElectricalUnion on Sunday August 25, 2024 @12:48AM
(#41344465)
Beginning with Oracle Database Release 23 [released May 2, 2024], it is now optional to select expressions using the FROM DUAL clause.
Doesn’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.
> what’s it gonna autocomplete?
otoh if you selected something the from clause and potentially some joins could autocomplete
PRQL gives me hope that we might finally get something nice some day