• 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>

  • 相关阅读:
    ASP.NET Web API +Swagger创建与汉化生成 API说明文档
    Apple 开发者账号 All In One
    CS50 2022 All In One
    TypeScript private field All In One
    js RegExp test bug All In One
    vite preview not work All In One
    Flutter Resources All In One
    table 组件性能优化 All In One
    Stanford CS193p All In One
    Swift 5.x bug All In One
  • 原文地址:https://www.cnblogs.com/shenggong/p/14034183.html
Copyright © 2020-2023  润新知