DDL
select @userName:='海绵宝宝' as '赋值查询名称';
#定义数值类型,看看是否可以进行四则运算
set @x=5,@y=7;#定义多个变量时可以使用,作为分割。
select @x+@y as '加法运算',@x-@y as '减法运算',
@x*@y as '乘法运算',@x/@y as '除法运算';#除法保留4位有效小数。
DDL
select @x<@y as '大小判断';#返回结果1代表true,如果是0代表false
select @x>=@y;
DDL
set @cityName='Rotterdam';
select *from city where `Name`=@cityName;
set @cityName1='Rotterdam';
set @cityName2='Zaanstad';
set @cityName3='Zwolle';
select *from city where `Name`in(@cityName1,@cityName2,@cityName3);
DDL
set @x=5,@y=7;#定义多个变量时可以使用,作为分割。
select @x+@y as '加法运算',@x-@y as '减法运算',
@x*@y as '乘法运算',@x/@y as '除法运算';#除法保留4位有效小数。
DDL
select @x<@y as '大小判断';#返回结果1代表true,如果是0代表false
select @x>=@y;
DDL
#浮点数0的处理
set @dx=0.11,@dy=55.5;
select @dx+@dy;#显示结果有很多的0
set @result=@dx+@dy;
select @result;#去掉0