#MySQL变量的定义与使用
# 1、不允许数字作为开头
# 2、只能使用_或¥符号,不允许使用其他符号
# 3、不允许使用关键字或保留字
String @userName='小可爱';
select @userName;
# 定义数值类型·整数·小数
set @x=5,@y=7;
select @x+@y,@x-@y,@x*@y,@x/@y;
#1、字符串查询
set @cityName='Haag';
select * from city where `Name`=@cityName;
#2、数值类型
set @popvalue='105819';
select * from city where Population=@popvalue;
MySQL变量的定义与使用
最新推荐文章于 2024-07-12 00:29:24 发布