AS clause

The AS clause allows you to give an alias name to EQL attributes and results.

The alias name can be given to an attribute, attribute list, expression result, or query result set. The aliased name is temporary, as it does not persist across different EQL queries.

Alias names must be NCName-compliant (for example, they cannot contain spaces). The NCName format is defined in the W3C document Namespaces in XML 1.0 (Second Edition), located at this URL: http://www.w3.org/TR/REC-xml-names/.

Note: Attribute names are not required to be aliased, as the names are already NCName-compliant. However, you can alias attribute names if you wish (for example, for better human readability of a query that uses long attribute names).
AS is used in:
  • DEFINE statements, to name a record set that will later be referenced by another statement (such as a SELECT or FROM clause).
  • RETURN statements, to name the EQL results. This name is typically shown at the presentation level.
  • SELECT statements, to name attributes, attribute lists, or expression results. This name is also typically shown at the presentation level.
Assume this DEFINE example:
DEFINE EmployeeTotals AS
SELECT
  DimEmployee_FullName AS Name,
  SUM(FactSales_SalesAmount) AS Total
GROUP BY DimEmployee_EmployeeKey, ProductSubcategoryName;
...

In the example, EmployeeTotals is an alias for the results produced by the SELECT and GROUP BY statements, while Name is an alias for the DimEmployee_FullName attribute, and Total is an alias for the results of the SUM expression.