LMSouq
database Open

How to duplicate a MySQL table, indices, and data?

XK
xkcd150
1 month ago
3 views
Problem Description
How do I copy or clone or duplicate the data, structure, and indices of a MySQL table to a new one? This is what I've found so far. This will copy the data and the structure, but not the indices: ```sql create table {new_table} select * from {old_table}; ``` This will copy the structure and indices, but not the data: ```sql create table {new_table} like {old_table}; ```

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base