SQL79. 别名
描述
vend_id | vend_name | vend_address | vend_city |
a001 | tencent cloud | address1 | shenzhen |
a002 | huawei cloud | address2 | dongguan |
a003 | aliyun cloud | address3 | hangzhou |
a003 | netease cloud | address4 | guangzhou |
vend_id | vname | vaddress | vcity |
a003 | aliyun cloud | address3 | hangzhou |
a002 | huawei cloud | address2 | dongguan |
a003 | netease cloud | address4 | guangzhou |
a001 | tencent cloud | address1 | shenzhen |
示例1
输入:
DROP TABLE IF EXISTS `Vendors`; CREATE TABLE IF NOT EXISTS `Vendors` ( `vend_id` VARCHAR(255) NOT NULL COMMENT '供应商id', `vend_name` VARCHAR(255) NOT NULL COMMENT '供应商名称', `vend_address` VARCHAR(255) NOT NULL COMMENT '供应商地址', `vend_city` VARCHAR(255) NOT NULL COMMENT '供应商城市' ); INSERT INTO `Vendors` VALUES ('a001','tencent cloud','address1','shenzhen'), ('a002','huawei cloud','address2','dongguan'), ('a003','aliyun cloud','address3','alibaba');
输出:
vend_id|vname|vaddress|vcity a003|aliyun cloud|address3|alibaba a002|huawei cloud|address2|dongguan a001|tencent cloud|address1|shenzhen
Mysql 解法, 执行用时: 39ms, 内存消耗: 6456KB, 提交时间: 2022-03-03
SELECT vend_id, vend_name AS vname, vend_address AS vaddress, vend_city AS vcity FROM Vendors ORDER BY vend_name
Mysql 解法, 执行用时: 39ms, 内存消耗: 6464KB, 提交时间: 2022-03-06
select vend_id,vend_name as vname, vend_address as vaddress,vend_city as vcity from Vendors order by vname asc
Mysql 解法, 执行用时: 39ms, 内存消耗: 6536KB, 提交时间: 2022-03-07
select vend_id,vend_name as vname,vend_address as vaddress,vend_city as vcity from Vendors order by vname
Mysql 解法, 执行用时: 39ms, 内存消耗: 6536KB, 提交时间: 2022-03-04
select vend_id,vend_name vname,vend_address vaddress,vend_city vcity from Vendors order by vname
Mysql 解法, 执行用时: 39ms, 内存消耗: 6692KB, 提交时间: 2022-03-08
SELECT vend_id,vend_name as vname,vend_address as vaddress,vend_city as vcity FROM Vendors order by vname;