Consistently using aliases for column names is useful for several reasons. The main one is that the code is independant from potential database modifications - when a column has been renamed to comply with standards for instance. Another reason is to remove ambiguity when querying several tables that may have equivalent column names.


== Noncompliant Code Example

----
BEGIN
  SELECT
    emp.name, -- Noncompliant - should be aliased
    dpt.name -- Noncompliant - should be aliased
  INTO employeesArray
  FROM employee emp INNER JOIN department dpt
  ON emp.DepartmentID = dpt.ID;
END;
/
----


== Compliant Solution

----
BEGIN
  SELECT
    emp.name employee_name, -- Compliant
    dpt.name departement_name -- Compliant
  INTO employeesArray
  FROM employee emp INNER JOIN department dpt
  ON emp.DepartmentID = dpt.ID;
END;
/
----

