Table aliases should be unique within each clause. It is recommended to name the aliases differently.
It is recommended to use explicit
AS clause for column expressions.
DISTINCTwith parenthesis SQL-L015
Parenthesis are not needed and confuse
DISTINCT with a function. The parethesis can also be misleading in which columns they apply to.
Tables should not be aliased if that alias is not used. An usused alias makes code harder to read without changing any functionality.
Ambiguous use of
DISTINCT in select statement with
JOIN clauses should not contain subqueries. Use Common Table Expression(CTE, aka WITH statement)s instead.
CASE statement in
ELSE clause could be flattened.
Queries that produce an unknown number of result columns are an anti-pattern.