题解 | #插入记录(二)#
插入记录(二)
http://www.nowcoder.com/practice/9681abf28745468c8adacb3b029a18ce
insert into exam_record_before_2021 (uid ,exam_id ,start_time,submit_time,score ) select uid ,exam_id ,start_time,submit_time,score from exam_record where year(submit_time ) <2021
#分享以下原来的解题思路, insert into exam_record_before_2021 select * from exam_record where year(submit_time ) <2021 数据表往往会设置自增列,常见的比如说 首列的ID列。 往数据表插入新数据的时候,自增列是跳过的,无需插入即会按照设置的自增规则进行列增长。 因此在插入的时候不需要对其执行跳过操作