Re:Best practices for writing SQL queries
by GordonS on Saturday April 10, 2021 @12:59PM
(#26762966)
It seems to be a matter of personal preference, but I've never liked single-character aliases myself, and never understood why so many seem to.
[ Parent
| on HN ]
Re:Best practices for writing SQL queries
by dspillett on Saturday April 10, 2021 @01:04PM
(#26763023)
Lazy typing: t is shorter than tableWithTheDataIWantIn
I prefer descriptive table and other object names, and abbreviate them in aliases within queries (though usually not to single letters).
Re:Best practices for writing SQL queries
by markmark on Saturday April 10, 2021 @05:45PM
(#26765433)
It's not just about lazy typing it's about removing unnecessary clutter from large queries that makes things harder to read. In the author/books example, repeating the words author and books a dozen times doesn't convey any information that a and b don't, but clutters up the query making it harder to see the useful parts.