Re:PostgreSQL Exercises
by combatentropy on Wednesday December 06, 2017 @05:33PM
(#15865709)
Yes. I wish SQL select-statements put the select-clause last:
from people
where name = 'Joe'
select upper(name) as bigname
1. It would mirror the other clauses (insert, update, and delete) which all begin with the table name.2. It would be easier on my head. I skip the select-clause anyway when reading SQL, then come back up to it at the end, when I know the columns' source.
3. It would show that using column aliases in the where-clause would fail (unless the database did some kind of two-pass processing).
You just described LINQ
You would think that an initial pass of SELECT could be made only to note any aliases. It would be a much appreciated nod to usability.
That seems straightforward enough, don't know why I assumed SQLite's implementation of it was a feature as opposed to a consequence of its overall simplified model. I think I assumed/hoped that aliasing worked as a kind of function definition which WHERE could magically understand and evaluate.
Re:PostgreSQL Exercises
by stats_n_trends on Wednesday December 06, 2017 @01:52PM
(#15863785)
As a counter point teradata (a ridiculously expensive closed source but fairly complex database) supports this feature. So it is definitely possible for this feature to be supported.
http://tinman.cs.gsu.edu/~raj/sql/node22.html