mysql数据库表插入单条数据/批量插入数据

1.创建表格

reate table trade(
        id int(4) not null primary key auto_increment,
        product varchar(30) null,
        price decimal(10,2),
        create_time timestamp
    )ENGINE=InnoDB DEFAULT CHARSET=utf8;;

2.单条插入

NSERT INTO trade
    (product, price, create_time)
    VALUES
    ("毛巾", 105, '2018-04-5 23:38:19');

INSERT INTO trade
     (product, price, create_time)
     VALUES
     ("枕头", 2, '2018-04-07 23:37:38');

3.多条插入

NSERT INTO trade
    (product, price, create_time)
    VALUES
    ("显示器", 500, '2018-05-07 23:37:25'),
    ("CPU", 200, '2018-06-07 23:37:38'),
    ("硬盘", 300, '2018-07-06 23:38:02'),
    ("内存", 400, '2018-08-5 23:38:19');

猜你喜欢

转载自www.cnblogs.com/apollo1616/p/10399225.html