字段拼接
-
CONCAT(str1,str2,…) 拼接的字符串中有一个是Null,那么返回结果就是Null
SELECT CONCAT(service_id,service_name)as id_name FROM t_sc_service; -
CONCAT_WS(separator,str1,str2,…) 拼接的字符串中有Null,返回结果也不会是Null
SELECT CONCAT_WS('-',service_id,service_name)as id_name FROM t_sc_service; -
GROUP_CONCAT(expr1,expr2) 一对多关系中
SELECT service_id,GROUP_CONCAT(service_name)as id_name FROM t_sc_service GROUP BY service_id;
字段判断字符包含
LIKE "%666%"FIND_IN_SET('666',name)LOCATE('666',name)>0
行转列,列转行
https://cloud.tencent.com/developer/article/1533688
https://www.w3xue.com/exp/article/201812/12440.html
https://zhuanlan.zhihu.com/p/139087541
博客介绍了MySQL相关操作,包括字段拼接,如CONCAT、CONCAT_WS、GROUP_CONCAT函数的使用及特点;还提及字段判断字符包含,以及行转列、列转行操作,并给出了相关参考链接。

被折叠的 条评论
为什么被折叠?



