SQL

SQL

Made by DeepSource

DISTINCT with parenthesis SQL-L015

Anti-pattern
Major

Parenthesis are not needed and confuse DISTINCT with a function. The parethesis can also be misleading in which columns they apply to.

Bad practice

SELECT DISTINCT(a), b FROM foo

Recommended

Remove parenthesis to be clear that the DISTINCT applies to both columns.

SELECT DISTINCT a, b FROM foo