zoukankan      html  css  js  c++  java
  • mysql 数据插入insert

    mysql> select * from user;
    +------+----------+-----------+
    | id   | name     | address   |
    +------+----------+-----------+
    |    1 | xiaoming | beijing   |
    |    2 | xiaobai  | shandong  |
    |    3 | xiaohong | suzhou    |
    |    4 | xiaohei  | changchun |
    +------+----------+-----------+
    4 rows in set (0.00 sec)
    
    
    mysql> insert user(id,name,address) values(5,"xiaoli","dongjing"),(6,"xiaohuang","meiguo");
    Query OK, 2 rows affected (0.01 sec)
    Records: 2  Duplicates: 0  Warnings: 0
    
    
    mysql> insert user(id,name,address) select id,name,address from user where id=1;
    Query OK, 1 row affected (0.01 sec)
    Records: 1  Duplicates: 0  Warnings: 0
    
    
    mysql> select * from user;
    +------+-----------+-----------+
    | id   | name      | address   |
    +------+-----------+-----------+
    |    1 | xiaoming  | beijing   |
    |    2 | xiaobai   | shandong  |
    |    3 | xiaohong  | suzhou    |
    |    4 | xiaohei   | changchun |
    |    5 | xiaoli    | dongjing  |
    |    6 | xiaohuang | meiguo    |
    |    1 | xiaoming  | beijing   |
    +------+-----------+-----------+
    7 rows in set (0.00 sec)
    mysql> insert into user(id,name,address) select id,name,address from user where id=1;
    Query OK, 2 rows affected (0.01 sec)
    Records: 2  Duplicates: 0  Warnings: 0
    
    
    mysql> select * from user;
    +------+-----------+-----------+
    | id   | name      | address   |
    +------+-----------+-----------+
    |    1 | xiaoming  | beijing   |
    |    2 | xiaobai   | shandong  |
    |    3 | xiaohong  | suzhou    |
    |    4 | xiaohei   | changchun |
    |    5 | xiaoli    | dongjing  |
    |    6 | xiaohuang | meiguo    |
    |    1 | xiaoming  | beijing   |
    |    1 | xiaoming  | beijing   |
    |    1 | xiaoming  | beijing   |
    +------+-----------+-----------+
    9 rows in set (0.00 sec)

  • 相关阅读:
    iOS企业账号打包发布App到自己服务器上
    DBus 接口
    Ubuntu下安装gazebo
    Ubuntu下添加开机启动脚本
    Ubuntu录屏软件Kazam
    使用ceres编译报错 error: ‘integer_sequence’ is not a member of ‘std‘
    LINUX中查看、添加、删除PATH以及永久添加PATH
    Ubuntu完美解决Github网站打不开问题
    PointNet原理详解
    目标检测算法RCNN,Fast RCNN,Faster RCNN
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11312834.html
Copyright © 2011-2022 走看看