我们知道通过insert into 表名(列名) values(值)是向表中插入一条语句,可是当我们需要向数据库插入多条语句时,应该怎么做呢?

可以通过如下格式的sql 语句来实现一次向数据库插入多行语句:

insert into 表名(列名)

select 值1

union all

select 值2

union all

select 值3

 

例如:

insert into int_browermark (id,mark)
select 1,'test7' union all
select 1,'test8' union all
select 1,'test9'

执行后,提示3行受影响:

通过sql 向数据库插入多行语句

 

相关文章:

  • 2021-12-12
  • 2022-01-01
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-01-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-07-03
  • 2021-08-31
  • 2022-12-23
相关资源
相似解决方案