变量
SET @my_var = 123;
...
WHERE var = @my_var
注意:
- 表名 不能用变量代替
- 引用的时候不能丢掉
@
获取当前数据库的信息
拿到一个新的数据库,先看一下表和各个字段
select table_name,column_name, column_comment
from information_schema.columns
order by table_schema,table_name;
获得指定的一张表的信息,
select table_name,column_name, column_comment
from information_schema.columns
WHERE TABLE_NAME='my_table'
order by table_schema,table_name;
时间相关 DateTime
- mysql中时间比较的实现: https://www.cnblogs.com/Darkqueen/p/9264087.html
- MySQL 笔记 —— 时间函数、时间比较: 最清晰,https://blog.csdn.net/qq_19865749/article/details/78535414