将查询结果复制到另一个mysql表

gsu*_*008 3 mysql sql

我正在尝试将大型CSV文件导入MySQL数据库.我已将整个文件加载到一个平面表中.我可以使用select语句选择需要进入单独表的数据,我的问题是如何将这些选择查询的结果复制到不同的表.我宁愿在SQL中完全完成它,也不必担心使用脚本语言.

Qua*_*noi 7

INSERT
INTO    new_table_1
SELECT  *
FROM    existing_table
WHERE   condition_for_table_1;

INSERT
INTO    new_table_2
SELECT  *
FROM    existing_table
WHERE   condition_for_table_2;
Run Code Online (Sandbox Code Playgroud)


tpd*_*pdi 6

INSERT INTO anothertable (list, of , column, names, to, give, values, for)
SELECT list, of, column, names, of, compatible, column, types
FROM bigimportedtable
WHERE possibly you want a predicate or maybe not;
Run Code Online (Sandbox Code Playgroud)