org.sonar.l10n.plsqlopen.rules.plsql.UnnecessaryAliasInQuery.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zpa-checks Show documentation
Show all versions of zpa-checks Show documentation
Z PL/SQL Analyzer :: Checks
The newest version!
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;