Duplicating and Deleting
Duplicating
Duplicate the entire table:
CREATE TABLE tb1_bk SELECT * FROM tb1;Duplicate the column structure only (not the records):
CREATE TABLE tb1_bkc LIKE tb1;Copy from another table:
INSERT INTO tb1_bkc SELECT * FROM tb1;Copy a specific column:
INSERT INTO tb1_bkc (name) SELECT empid FROM tb1;Deleting
Drop a table if it exists:
DROP TABLE IF EXISTS tb1A;Drop a database:
DROP DATABASE db0;Delete all records from a table:
DELETE FROM tb1_bk;Last updated
Was this helpful?