|
|
|
|
|
by jolmg
1400 days ago
|
|
Having SELECT come first makes sense to me because it's the only part of the statement that's required. FROM and everything else is optional. Also when reading a statement, you're mostly interested in what the returned fields are rather details like where they came from or how they're ordered. It kind of makes sense to put it at the start. Maybe other syntax forms have their benefits, specially when writing, but I don't think SQL's choice is completely senseless either. |
|
Only *IN SQL*.
You don't need it on the relational model, heck, no even in any other paradigm:
That is!. (aka: SELECT 1)So this:
is because SQL is made weird. More correctly, this should be only: Also, SELECT is not required all the time, you wanna do: But you probably think this as weird, because SQL in his peculiar implementation, that is, ok for one-off, ad-hoc query, and in THAT case, having the list of fields first is not that bad.But now, when you see it this way, you note how MUCH nicer and simpler it could have been, because then each "fragment" of a SQL query could become *composable*.
But not on SQL, where the only "composition" is string concatenation, that is bad as you get.