创建表

create table new_table_name as select * from (your_sql) as sql_table;

new_table_name 替换为创建表名
your_sql 替换为sql语句


插入表

insert into old_table_name select * from (your_sql) as sql_table;

old_table_name 替换为已经存在的表名
your_sql 替换为sql语句

语句最后的sql_table是给your_sql 生成的暂存表起个别名,避免出现[Err] 1248 - Every derived table must have its own alias