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>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-09-22
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
猜你喜欢
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2021-07-20
  • 2021-07-17
相关资源
相似解决方案