• 普通插入(全字段):INSERT INTO table_name VALUES (value1, value2, ...)
  • 普通插入(限定字段):INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...)
  • 多条一次性插入:INSERT INTO table_name (column1, column2, ...) VALUES (value1_1, value1_2, ...), (value2_1, value2_2, ...), ...
  • 从另一个表导入:INSERT INTO table_name SELECT * FROM table_name2 [WHERE key=value]

年份比较 year()

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 submit_time IS NOT NULL and YEAR(submit_time) < '2021';