mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mydb |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.01 sec)
mysql> use mydb
Database changed
mysql> show tables;
+----------------+
| Tables_in_mydb |
+----------------+
| employee |
+----------------+
1 row in set (0.01 sec)
mysql> desc employee
-> ;
+--------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------+------+-----+---------+-------+
| Id | int(11) | NO | PRI | NULL | |
| Salary | int(11) | YES | | NULL | |
+--------+---------+------+-----+---------+-------+
2 rows in set (0.05 sec)
mysql> SELECT * INTO employees FROM employee;
ERROR 1327 (42000): Undeclared variable: employees
mysql> CREATE TABLE employees(SELECT * FROM employee);
Query OK, 3 rows affected (0.02 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> show tables;
+----------------+
| Tables_in_mydb |
+----------------+
| employee |
| employees |
+----------------+
2 rows in set (0.00 sec)
mysql>