The AS clause names or renames a column or expression that appears in a SELECT clause. Example:
Prior to DB2 V4.1, the only way to rename a column was to create a VIEW -- a cumbersome procedure.
Query coded the old way:
SELECT FIRSTNME AS FIRST_NAME ...
Produces this result:
Query coded the new way, with column renaming:
Produces this delightful result:
CREATE VIEW DZ002.EMPVIEW
(EMPNO, FIRSTNME, MONTHLY_SALARY)
AS SELECT EMPNO, FIRSTNME, INTEGER(SALARY/12.00)
FROM DZ002.EMP
CREATE VIEW DZ002.EMPVIEW
AS SELECT EMPNO, FIRSTNME,
INTEGER(SALARY/12.00) AS MONTHLY_SALARY
FROM DZ002.EMP
©Copyright 1996 Chuck Anesi all rights reserved