计算字段是将存储表中的数据进行相应的转换与计算或者格式化后得到数据
计算字段是运行时在色select语句内创建的。
拼接字段 concatenate 将值连接到一起构成单个值 concat()函数
select concat(vend_name,'(',vend_country,')') from vendors order by vend_name;
trim()函数用于删除字符串左右两边的空格
别名 AS 关键字 重命名也行
select concat(trim(vend_name),'(',vend_country,')') as vend_title from vendors order by vend_name;
select concat(trim(vend_name),'(',vend_country,')') as vend_title1 from vendors order by vend_name;
select order_num prod_id,quantity,item_price from orderitems where order_num = 20005;
select order_num prod_id,quantity,item_price ,quantity*item_price as expanden_price from orderitems where order_num = 20005;
网友评论