文件名称:定义一个列别名-SQL语言基础
文件大小:5.26MB
文件格式:PPT
更新时间:2024-05-15 13:24:47
SQL 基础
定义一个列别名 * 重新命名一个列的名字有时很有用; 可以用AS关键字为列名取一个别名; 如果别名中包含空格,或者其他特殊自符,则需要用引号(“”)将别名包含起来。 * Column Aliases When displaying the result of a query, SQL*Plus normally uses the name of the selected column as the column heading. In many cases, this heading may not be descriptive and hence is difficult to understand. You can change a column heading by using a column alias. Specify the alias after the column in the SELECT list using a space as a separator. By default, alias headings appear in uppercase. If the alias contains spaces, special characters (such as # or $), or is case sensitive, enclose the alias in double quotation marks (" "). Instructor Note Within a SQL statement, a column alias can be used in both the SELECT clause and the ORDER BY clause. You cannot use column aliases in the WHERE clause. Both alias features comply with the ANSI SQL 92 standard. Demo: l1alias.sql Purpose: To illustrate the use of aliases in expressions.