MySQL常用语句
- 取奇数行
select * from temp,(select @num:=0) num where (@num:=@num+1)%2=1
- 时间-2 hour
select date_add(‘2019-01-24 14:42:52’,interval -2 hour)
- 取表里的随机一条记录
select * from temp order by rand() limit 1
- 存储过程
DROP PROCEDURE IF EXISTS num;
DELIMITER //
CREATE PROCEDURE num()
BEGIN
‘’‘
END
call num()
- 星期几
select weekday(current_timestamp())+1;