MySQL Clone Tables
Overview
Creating a copy of an existing table is useful for backup, testing, or data migration. MySQL provides multiple ways to clone tables including structure, data, or both.
Clone Methods
- CREATE TABLE AS: Create from SELECT query
- CREATE TABLE LIKE: Copy structure only
- INSERT SELECT: Copy data to existing table
- mysqldump: Full table export
CREATE TABLE AS / CREATE TABLE AS
Copy Structure and Data
Copy with New Columns
CREATE TABLE LIKE / CREATE TABLE LIKE
Copy Structure Only
Copy with Specific Options
INSERT SELECT / INSERT SELECT
Copy Data to Existing Table
Bulk Copy
Complete Clone Workflow
Step 1: Create Structure
Step 2: Copy Data
Step 3: Verify
Clone with mysqldump
Export Table
Import Table
Clone Across Databases
Copy to Another Database
Clone with mysqldump
Clone with Constraints
Copy with Primary Key
Copy with Foreign Keys
Clone Performance
Optimizing Large Table Copies
Monitoring Copy Progress
Clone Scenarios
Scenario 1: Backup Before Changes
Scenario 2: Archive Old Data
Scenario 3: Create Test Environment
Scenario 4: Data Migration
Clone with mysqldump Advanced
Partial Table Clone
Clone to Different Server
Summary
Cloning tables in MySQL provides:
- Backup: Create copies for safety
- Testing: Clone for development
- Migration: Move data between schemas
- Archive: Move old data to archive
- Multiple Methods: CREATE TABLE AS, LIKE, mysqldump
Choose appropriate method based on your needs: full copy, structure only, or data only with transformations.
Previous: Temporary Tables
Next: Metadata