insert into 表名 set

insert into 表名 set

CREATE TABLE `tbl_str` (
  `id` INT DEFAULT NULL,
  `Str` VARCHAR(30) DEFAULT NULL
)

##批量
INSERT INTO `mytest`.`tbl_str` (`id`, `Str`) 
VALUE
  ('1', 'hello world'),
  ('2', 'mysql string'),
    ('3', 'hello');

##value和values都可以 
##单条
INSERT INTO `mytest`.`tbl_str` (`id`, `Str`) 
VALUE
  ('4', 'hello world2');
 

##可以单条添加
INSERT INTO `mytest`.`tbl_str` SET id = 10,str = 'nihao'

#多条不可以
#INSERT INTO `mytest`.`tbl_str` 
#SET id = 11,str = 'dbadmin'
#SET id = 12,str = 'dbadmin2'

 

posted on 2023-12-24 18:47  oktokeep  阅读(16)  评论(0编辑  收藏  举报