#字符串拼接 concat(s1,s2); 将表中last_name和first_name中的字符串拼接
select concat(last_name,first_name) as 姓名 from employees;
#只会修改last_name不会修改first_name
SELECT first_name,last_name AS f FROM employees;
#将两个列用逗号隔开并命名为out_put
SELECT CONCAT(`last_name`,‘,‘,`phone_number`) AS out_put FROM employees;
#ifnull 判断是否为空,如果为空则显示为0而不是null,并将列名显示为结果
SELECT IFNULL(commission_pct,0) AS 结果 FROM employees;
原文地址:https://blog.51cto.com/14437184/2434445
时间: 2024-10-01 07:51:14