可以给字段 表达式 函数 以及表 取别名

语法:

select 字段名 函数别名 from 表名;

例如 :

select bookname name from book;
##这里是将name设置为bookname的别名;

为多个字段起别名:

select 函数1 函数1别名,函数2 函数2别名 from b表名;

例如:

select number num,price money from book;

##这里将num设置为number的别名,将money设置为price的别名;

表达式别名:
语法:

select 表达式 别名 from 表名;

例如:

select name,price*12 totalprice from book;

##返回结果 将price*12的别名设置为 totalprice

函数别名:
语法:

select 函数名 别名(英文名可以直接写) from 表名;

语法二(取别名关键字 as):
select 函数名 as 别名 from 表名;
##中文别名需要用引号 引起来
##中间有空格的别名 例如 avg m 需要加引号 ‘avg m’

例:

select avg(price) avgmoney from book;
select avg(price) as avgmoney from book;

##两者一样,可以省略 as