1. 程式人生 > >mysql數據庫表插入單條數據/批量插入數據

mysql數據庫表插入單條數據/批量插入數據

mysql ice insert values utf 顯示 into creat timestamp

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');

mysql數據庫表插入單條數據/批量插入數據