select now();
2.查看存储过程变量
select @a;

mysql > select 'hello world' into @x;
mysql > select @x;
+-------------+
| @x |
| hello world |
mysql > set @y='goodbye cruel world';
mysql > select @y;
+---------------------+
| @y |
| goodbye cruel world |
mysql > set @z=1+2+3;
mysql > select @z;
+------+
| @z |
| 6 |
注意 :
① 用户变量名一般以 @ 开头
② 滥用用户变量会导致程序难以理解及管理
2.添加标识字段和初值
select 1 flag;
3.通过动态标识来选择
select * from user where true; 返回所有
select * from user where false; 返回空
实战 根据用户是否有所有project权限来取出所有project
select * from project where (select is_all_project from user where use_id =13)