Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » SQL Anywhere Server - SQL Usage » Query and modify data » Queries » The SELECT list: Specifying columns

 

Renamed columns in query results

By default, the heading for each column of a result set is the name of the expression supplied in the SELECT list. For expressions that are column values, the heading will be the column name. In embedded SQL, one can use the DESCRIBE statement to determine the name of each expression returned by a cursor. Other application interfaces also support querying the names of each result set column through interface-specific mechanisms. The sa_describe_query system procedure offers an interface-independent means to determine the names of the result set columns for an arbitrary SQL query.

You can override the name of any expression in a query's SELECT list by using an alias, as follows:

SELECT column-name [ AS ] alias

Providing an alias can produce more readable results. For example, you can change DepartmentName to Department in a listing of departments as follows:

SELECT DepartmentName AS Department,
   DepartmentID AS "Identifying Number"
FROM Departments;
Department Identifying Number
R & D 100
Sales 200
Finance 300
Marketing 400
... ...
 Usage
 See also