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)