SQL

SQL

Made by DeepSource

Unqualified references SQL-L027

Bug risk
Major

References should be qualified if SELECT has more than one referenced table/view.

NB: Except if they’re present in a USING clause.

Bad practice

In this example, the reference ‘vee’ has not been declared and the variables ‘a’ and ‘b’ are potentially ambiguous.

SELECT a, b
FROM foo
LEFT JOIN vee ON vee.a = foo.a

Recommended

Add the references.

SELECT foo.a, vee.b
FROM foo
LEFT JOIN vee ON vee.a = foo.a