SQL SELECT AS
SQL AS 用于将新名称临时分配给表列。
这很容易呈现查询结果,并允许开发人员在不永久重命名表列的情况下更准确地标记结果。
让我们看一下select as的示例:
SELECT day_of_order AS "Date"
Customer As "Client",
Product,
Quantity,
FROM orders;
我们来看一个名为orders的表,它包含:
Day_of_order |
Customer |
Product |
Quantity |
11-09-2001 |
Ajeet |
Mobile |
2 |
13-12-2001 |
Mayank |
Laptop |
20 |
26-12-2004 |
Balaswamy |
Water cannon |
35 |
应用此SQL AS示例语法后
SELECT day_of_order AS "Date"
Customer As "Client",
Product,
Quantity,
FROM orders;
结果将显示为此表:
Date |
Client |
Product |
Quantity |
11-09-2001 |
Ajeet |
Mobile |
2 |
13-12-2001 |
Mayank |
Laptop |
20 |
26-12-2004 |
Balaswamy |
Water cannon |
35 |
注意: SQL AS与SQL ALIAS相同。