(no title)
paozac | 4 years ago
The first thing (among many others) that I would change in SQL is the position of the SELECT clause:
FROM .. JOIN .. SELECT .. WHERE ..
instead of
SELECT .. FROM .. JOIN .. WHERE ..
That would make the construction of many queries more natural.
JoelJacobson|4 years ago
So if we could rewrite history, I agree the order you suggest would make more sense, but it’s probably unrealistic to change it, except for entirely new SQL inspired languages.
To comment on having to look up foreign keys. The idea I had in mind is to allow changing the default formatting of foreign key names, so you could figure out the name, except in special cases such as if there would be two foreign keys referencing the same table. For such cases you should explicitly name the foreign keys.
tejtm|4 years ago
FROM .. JOIN .. WHERE .. SELECT
tables -> columns -> rows -> filter
I think they knew that but decided they wanted DBAs to think about what they wanted to end up with before they began writing code, so they moved the last step to the first step. I can get behind that from a pedagogical perspective.
However today, relational databases are far too ubiquitous to always get the level of serious thought and considerations they were once afforded, and are regularly being used by (perish the thought) non-DBAs.
At this point it is muscle memory to start with:
then comment out the `--count(*)` and build up the output after the body works because I may not know what is available to select before isolating it.alserio|4 years ago
shazzdeeds|4 years ago
jansommer|4 years ago
zamalek|4 years ago
BeefWellington|4 years ago
If it were a proposal for a SQL21 standard to offer this as an optional method for query processing, I'd be all for it.
However, the idea of "non-optional followed by optional" came from an era where that sort of thing mattered and it made sense.
emidln|4 years ago