Copy query result to another mysql table

I am trying to import a large CSV file into a MySQL database. I uploaded the entire file to one flat table. I can select the data that needs to be moved to separate tables using select statements, my question is how to copy the results of these select queries to different tables. I would rather do it completely in SQL and not worry about using a scripting language.

+3
source share
3 answers
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;
+4
source
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;
+7
source

, . , new_table_1 , "INSERT INTO" "CREATE TABLE".

0

Source: https://habr.com/ru/post/1706131/


All Articles