1
2
3
4
5 CREATE TABLE IF NOT EXISTS new_table LIKE existing_table;
6
7INSERT new_table
8SELECT * FROM existing_table;
1CREATE table `duplicat` LIKE `orginal`;
2INSERT `duplicat` SELECT * FROM `orginal`;
1SELECT firstname,
2 lastname,
3 list.address
4FROM list
5 INNER JOIN (SELECT address
6 FROM list
7 GROUP BY address
8 HAVING COUNT(id) > 1) dup
9 ON list.address = dup.address;
10
1# Duplicate rows or row
2INSERT INTO table (col1, col2, col3)
3SELECT col1, col2, col3 FROM table
4WHERE something...;
1# Duplicate row and change values in the duplicated row
2INSERT INTO table (col1, col2, col3)
3# manually insert data to the duplicated row
4SELECT "new value", "new value", "new value" FROM table
5WHERE something...;