Communicator e3000 MPE/iX Release 7.0 Express 1 (Software Release C.70.01) (30216-90328)

126 Chapter6
Technical Articles
AS Clause Enhancement in Allbase/SQL.
AS Clause Enhancement in Allbase/SQL.
By Sekhar N.D
CSY - Databases
Objectives of the Enhancement
The objective of the enhancement is to allow 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.
Usage of Column Alias Name
The syntax of the Select Statement with Alias Name:-
========== 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 partnumber;
If the alias name is specified as an identifier it should conform to the following rules which
are the rules defined for "Basic Names" in Allbase/SQL.