If there is a database which contains user name, password and other fields. But how to take copy of table contents to new table.
If you are a DBA administrator you should have a copy of original database or table. Let’s see here how to copy the contents of a table into a new table.
MySQL query to copy table content to new table.
mysql> CREATE TABLE studentbak LIKE ttt_ria.student;
Query OK, 0 rows affected (0.03 sec)
mysql> insert studentbak select * from ttt_ria.student;
Query OK, 4 rows affected (0.02 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> select * from studentbak;
+------+--------------+------+-----------------+
| id | name | age | dept |
+------+--------------+------+-----------------+
| 1 | karthikeyan | 22 | Internet |
| 2 | Arun Shakthi | 22 | Consultancy |
| 3 | manikandan | 22 | Management |
| 4 | meena | 22 | Human Resources |
+------+--------------+------+-----------------+
4 rows in set (0.00 sec)
Here ttt_ria is database and student is a old content table and studentbak is a new table.