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,'%');
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,'%');