一、SQL别名的基本用法
SQL可以为表或者列指定别名。
语法格式如下(表):
SELECT 列名1,列名2... FROM 表名 AS 别名;
语法格式如下(列):
SELECT 列名1 AS 别名1,列名2 AS 别名2... FROM 表名;
示例student表:
例子(表):
SELECT * FROM student AS N WHERE N.name = '小明';
运行结果:
例子(列):
SELECT student_number AS a,name AS b,class_id AS c FROM student;
运行结果: