新建连接,自带world数据库,里面自带city表格。
# MySQL利用变量进行查询操作
set @cityName='Haarlemmermeer';
select * from city where `Name`=@cityName;
# 多个结果查询
set @cityName1='Haarlemmermeer';
set @cityName2='Breda';
set @cityName3='Willemstad';
select * from city where `Name` in (@cityName1,@cityName2,@cityName3);
结果: