zoukankan      html  css  js  c++  java
  • mysql select into的变通方法

    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>

  • 相关阅读:
    前端基础之BOM和DOM
    前端基础之JavaScript
    前端基础之CSS
    Black And White HDU
    Robot Motion HDU
    A Knight's Journey POJ
    Find a way HDU
    排序 HDU
    Dungeon Master POJ
    Network Saboteur POJ
  • 原文地址:https://www.cnblogs.com/shenggong/p/14034183.html
Copyright © 2011-2022 走看看