书上说,insert语句中给出具体的值,每次只能插入一行。要插入其他的每一行,必须再次指定insert关键字,再次给出表和相关栏的名字,really,sigh...

解决方案 »

  1.   

    多条纪录的插入利用select 子句insert into titles(...)
    select ... from table1 -----这条语句包含你要插入的批量数据如果你只是单独的纪录
    只能写多条掉纪录的插入,即把你的改为:INSERT INTO titles
             (title_id, title, type, pub_id, price)
    VALUES   ('BU9876', 'Creating Web Pages', 'business', '1389', '29.99'),
    INSERT INTO titles
             (title_id, title, type, pub_id, price)
    VALUES   ('BU9877', 'Creating Web Pages', 'business', '1389', '29.99'),
    INSERT INTO titles
             (title_id, title, type, pub_id, price)
    VALUES   ('BU9878', 'Creating Web Pages', 'business', '1389', '29.99'),
    INSERT INTO titles
             (title_id, title, type, pub_id, price)
    VALUES   ('BU9879', 'Creating Web Pages', 'business', '1389', '29.99')
      

  2.   

    不过可以用select插入若干行从另一个表里选择数据插入这个表
      

  3.   

    INSERT INTO titles
             (title_id, title, type, pub_id, price)
    select 'BU9876', 'Creating Web Pages', 'business', '1389', '29.99' union all
    select 'BU9877', 'Creating Web Pages', 'business', '1389', '29.99' union all
    select 'BU9878', 'Creating Web Pages', 'business', '1389', '29.99' union all
    select 'BU9879', 'Creating Web Pages', 'business', '1389', '29.99'