Communicator e3000 MPE/iX Release 6.5 Express 2 (Software Release C.65.02) (30216-90322)

22 Chapter3
Technical Articles
Using the AS Clause in ALLBASE/SQL
Using the AS Clause in ALLBASE/SQL
By Kumaran N.S.
Commercial Systems Division - Database
The AS Clause allows users to specify an alias name for the items in the Select Statement.
The specified alias name will be returned as the column heading in the query result.
Syntax
-- Select Statement Level --
[BULK] QueryExpression [ORDER BY {ColumnID [ASC ]} [,...]]
[ { [DESC]} ]
-- Subquery Level --
(QueryExpression)
-- Query Expression Level --
{QueryBlock } [UNION [ALL] {QueryBlock }] [...]
{(QueryExpression)} [ {(QueryExpression)}]
-- Query Block Level --
SELECT [ALL ] SelectList [INTO HostVariableSpecification]
[DISTINCT]
FROM FromSpec [,...] [WHERE SearchCondition1] [GROUP BY GroupColumnList]
[HAVING SearchCondition2]
where SelectList =
{* }
{[Owner.]Table.* }
{CorrelationName.* } [,...]
{Expression AS Alias_name }
{[[Owner.]Table.]ColumnName AS Alias_name }
{CorrelationName.ColumnName AS Alias_name}
where Alias_name can be an identifier, a single-quoted string or a
double-quoted string
Example
SELECT PartNumber AS "Part Number" , AVG (UnitPrice) AS avg_price,
AVG (deliverydays) AS 'avg days' FROM PurchDB.SupplyPrice GROUP BY