Creating a new table using mysql query information

by GOKILAVANI 2014-06-16 09:36:25

mysql create new table:

mysql> create table foo(id int, vorta text);
Query OK, 0 rows affected (0.02 sec)

Insert values into the table created:

mysql> insert into foo values(1, 'for the hoarde');
Query OK, 1 row affected (0.00 sec)

View the content of the table using select query:
 
mysql> select * from foo;
+------+----------------+
| id   | vorta          |
+------+----------------+
|    1 | for the horde  |
+------+----------------+
1 row in set (0.00 sec)

Create a new table with information from a query:

mysql> create table foo2 select * from foo;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0


View the content of the new tabel using select query:

mysql> select * from foo2;
+------+----------------+
| id   | vorta          |
+------+----------------+
|    1 | for the horde  |
+------+----------------+
1 row in set (0.00 sec)
995
like
0
dislike
0
mail
flag

You must LOGIN to add comments