Skip to content

unused-alias

SQLstyleno fixdefault: offsql/sqlfluff

Reports a table alias in a FROM clause that no qualified reference of the select, nested queries included, uses.

An alias that nothing uses is left over from an earlier version of the query, or a reference was written without it.

To fix, remove the alias, or use it.

Reported
...
with c as (select a from t) select * from c;
select x.a from (select * from t) as x;
select a from t as x;
select x.a from t as x join u as y on x.id = y.id;
sql:
lint:
rules:
unused-alias: warn # off (default), warn, error

Enabled by the presets: sql/sqlfluff.

Suppress one line with sudsy-disable-next-line unused-alias in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
sqlfluff AL05 full