📜  SQL SELECT AS

📅  最后修改于: 2020-11-11 04:35:23             🧑  作者: Mango

SQL选择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相同。