题解 | #删除记录(一)#
删除记录(一)
https://www.nowcoder.com/practice/d331359c5ca04a3b87f06b97da42159c
主要在函数使用,mysql日期相减得到分钟有2种方法
1,timestempdiff
TIMESTAMPDIFF(MINUTE,start,end)
那么,
DELETE FROM exam_record
WHERE TIMESTAMPDIFF(MINUTE, start_time, submit_time) < 5
AND score < 60;
2,minute和timediff 结合使用
TIMEDIFF(start, end) 得到两个日期之间的差值.
TIMEDIFF函数接受两个必须为相同类型的参数,即TIME或DATETIME。
delete from exam_record where minute(TIMEDIFF(submit_time,start_time))<5 and score<60