Mysql 笔记(四)Concat用法

    concat是降字符串连接起来

    表:world(id,name,capital)

    1.显示所有国家名字,其中首都是国家名字加上‘City’

    select name from world where capital=concat(name,' City');

    2.找出所有首都和其国家名字,其中首都都要有国家名字出现

    select capital,name from world where capital like concat('%',name,'%');

猜你喜欢

转载自blog.csdn.net/xiaoxiaoliluo917/article/details/80579037