MySQL - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

MySQL Clone

MySQL Clone

shape Description

A record in the MySQL Database table is said to be clone and a MySQL Clone can be described as copying the records in the database or replicating the record from the Database. By viewing the below example, the concept of Clone can be easily understood.

MySQL Clone Example

shape Step - 1

Identify the table records for cloning. [sql] mysql> select * from settings where hostname="php"; +-------------+------+----------+ | value | data | hostname | +-------------+------+----------+ | AC3PassThru | 0 | php | +-------------+------+----------+ 1 row in set (0.00 sec)[/sql]

shape Step - 2

Cloning the above table record "php". [sql]mysql> insert into settings select * from settings where hostname="php"; Query OK, 1 row affected (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> select * from settings where hostname="php"; +-------------+------+----------+ | value | data | hostname | +-------------+------+----------+ | AC3PassThru | 0 | php | | AC3PassThru | 0 | php | +-------------+------+----------+ 2 rows in set (0.00 sec)[/sql] Here in the above example, the host name and all other values are repeated by performing the Clone operation.

Summary

shape Key Points

  • MySQL Clone - Copying or replicating a record in the database is said to be clone.