sql语句中as的意思是别名,或者说给显示的结果改名。比如,select
name
as
姓名
from
student.
意思是查询student表中的name字段,但是在显示的时候显示姓名(而不是表中的name)
还比如下面:concat(path,',',id)函数用","把前后字段【path和id】连接起来形成一个新字段
改名为fullpath
select
id,catename,path,concat(path,',',id)
as
fullpath
from
likecate
where
1
order
by
fullpath
asc.
扩展资料:
as
一般用在两个地方,一个是query的时候,用来重新指定返回的column(列)
名字
如:一个table
有个column叫
id,
我们的query是
select
id
from
table1.
但是如果你不想叫id了,就可以重新命名,如叫
systemID
就可以这样写
select
id
as
systemId
from
table1;
还有一个用法就是在create
table
或
procedure
的时候,as
是个关键字。
例如
create
table
test
as
select
*
from
table1
这时候就会create
一个table
test,他是完全copy
表table1里的全部数据。
create
procdure
name
as
(is)
begin
end;
具体可以参考
如何建立procedure。
这个时候
as
和is可以互换。
参考资料:
搜狗百科-sql语句