#MYSQL变量的定义与使用
#一、标识符命名规范
set @userName="小可爱";
select @userName as '结果名称';
select @userName as '海绵宝宝' as '赋值查询名称';
set @x=5,@y=7;
select @x + @y as '加法运算', @x - @y as '减法运算',
@x * @y as '乘法运算',@x / @y as '除法运算',@x % @y as '取模运算';
select @x < @y as '大小判断';
select @x>= @y;
select TRUE or false;
set @cityName='Rotterdam,Zaanstad,Zwolle';
select * from city where`name` =@cityName;
set @cityName1='Rotterdam';
set @cityName2='Zaanstad';
set @cityName3='Zwolle';
select * from city where `Name` in (@cityName1,@cityName2,@cityName3);
set @dx=0.11,@dy=55.5;
select @dx +@dy;
set @result=@dx + @dy;
select @result;
mysql
最新推荐文章于 2025-05-17 15:39:07 发布