MySQL query to generate INSERT statements for all tables
MySQL query to generate INSERT statements with columns for all tables in the current database: — Increase limit for GROUP_CONCAT() to avoid text cutoff SET SESSION group_concat_max_len = 1048576; SELECT CONCAT( ‘\n\n’, GROUP_CONCAT(CONCAT( ‘INSERT INTO `’, table_name, ‘` (‘, columns, ‘) VALUES ()’ ) SEPARATOR ‘\n\n’), ‘\n’ ) AS result FROM ( SELECT table_name, GROUP_CONCAT(CONCAT(‘`’, …
Continue reading “MySQL query to generate INSERT statements for all tables”