Is it possible to insert the same values at once (Mysql)?
This question already has an answer here:
INSERT INTO Example (column_name) VALUES ('Red'),('Black'),('Green');
Yes you can do this, but your format is off.
INSERT INTO `Example` (`color`)
VALUES
('Red'),
('Black'),
('Green')
Each row must be separated by a comma with values for the row in parenthesis.
这是另一种适用于任何数据库的方式。
insert into example
select 'Red'
from SomeSmallTable
union
select 'Blue'
from SomeSmallTable
union
select 'Green'
from SomeSmallTable
链接地址: http://www.djcxy.com/p/94494.html
上一篇: 我有一个不正确的语法错误
下一篇: 是否可以一次插入相同的值(Mysql)?