by twoodfin · 5y ago · 0 comments
Rule_L031: Avoid table aliases in from clauses and join conditions.
I can't see what makes aliases clarifying in `select` or `where` but not in `join`. Also, inlined subqueries in a join must be given an alias, so there are cases where this rule can't be applied consistently.
sales.amount orders.due_date
vs
s.amount ord.due_date
In the second example I have to flip back and forth between the join statement in order to know where the columns are coming from.
If you have awful table names though like qq123xc then I think aliasing would be appropriate
Moreover, there's nothing wrong with saying `SELECT ... FROM sales sales ...`.
schema.adjective_noun_adjective_noun as ananInlined subqueries are creating entirely new projections so they need descriptive names. If you are doing this you should consider a WITH anyway.