Pular para o conteúdo principal

Unnecessary alias for table reference

An alias can be used in tables when you plan to add the same table more than once in the FROM clause (e.g. self join), or you want to shorten the table name to make the SQL statement shorter and easier to read. But when abused, aliases can have the opposite effect: decrease legibility.

Consider using aliases only when the table appears more than once in a query.

Noncompliant Code Example

SELECT a.id,
b.id,
b.name
FROM employee a,
dept b
WHERE a.dept_id = b.id;

Compliant Solution

SELECT employee.id,
dept.id,
dept.name
FROM employee,
dept
WHERE employee.dept_id = dept.id;