A handy little feature I recently learned about is super simple to work with. Use this to copy the structure of a table:
CREATE TABLE table2 ( LIKE table1 INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES );
Then you can copy data into your new table at your liking with:
INSERT INTO table2 SELECT * FROM table LIMIT 100;
Happy programming!
Top comments (0)