一条insert语句如何插入两条数据?
给个例子

解决方案 »

  1.   

    INSERT table_1(ID,Name) SELECT '1111','john' UNION SELECT '1112','kitty'; 
      

  2.   

    INSERT table_1(ID,Name) values(1,'aa'),(2,'bb')
      

  3.   

    INSERT INTO test (name, pwd) VALUES (name1, pwd1),(name2,pwd2),(name3,pwd3),;
      

  4.   

     insert into t  values (1),(2);
      

  5.   

    INSERT INTO test (name, pwd) VALUES (name1, pwd1),(name2,pwd2);
      

  6.   

    没条数据之间用逗号隔开,你可以打开dump一个SQL文件,然后打开看看
      

  7.   

    insert into table1 (col1,col2) values (v1,v2),(v3,v4);这是MYSQL中特有的语法。MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html
      

  8.   

    mysql> create table testdate(id int primary key, startdate date, days int);
    Query OK, 0 rows affected (0.09 sec)mysql> insert into testdate values(1, '2010-04-11', 15);
    Query OK, 1 row affected (0.03 sec)mysql> select * from testdate;
    +----+------------+------+
    | id | startdate  | days |
    +----+------------+------+
    |  1 | 2010-04-11 |   15 | 
    +----+------------+------+
    1 row in set (0.00 sec)
    mysql> insert into testdate values(2, '2010-05-11', 10), (3, '2010-06-29', 1);
    Query OK, 2 rows affected (0.01 sec)
    Records: 2  Duplicates: 0  Warnings: 0mysql> select * from testdate;
    +----+------------+------+
    | id | startdate  | days |
    +----+------------+------+
    |  1 | 2010-04-11 |   15 | 
    |  2 | 2010-05-11 |   10 | 
    |  3 | 2010-06-29 |    1 | 
    +----+------------+------+
    3 rows in set (0.00 sec)
      

  9.   

    create table haha
    (
    hid int not null,
    haname varchar(50) not null
    );insert into haha(hid,haname) values (1,'haha'),(2,'hehe')select * from haha恩,可以的,本人亲手试过
      

  10.   

    create table haha
    (
    hid int not null,
    haname varchar(50) not null
    );insert into haha(hid,haname) values (1,'haha'),(2,'hehe')select * from haha
    有效,那个sql-yag 的客户端导出sql时,也是按这种格式导出的。