在INSERT语句中为所有VALUES指定公共列值的方法?

时间:2017-01-04 05:46:14

标签: mysql insert default

我有一张桌子,里面会有数千行。我在一个文本文件中有一堆INSERT语句,我读入db进行测试:

INSERT into my_table (c1, c2, c3, c4) VALUES
   ("aaaAA",   "aaaAB",   "aaaAC", "foo"),
   ("aaaBA",   "aaaBB",   "aaaBC", "foo"),
   [ ... etc ... ]
   ;

 INSERT into my_table (c1, c2, c3, c4) VALUES
   ("bbbAA",  "bbbAB",  "bbbAC",  "bar"),
   ("bbbBA",  "bbbBB",  "bbbBC",  "bar"),
   [ ... etc ... ]
   ;

这一切都很有效,但如果我可以这样的话,它会更清洁(也更容易):

 INSERT into my_table (c1, c2, c3, c4="foo") VALUES
   ("aaaAA",   "aaaAB",   "aaaAC"),
   ("aaaBA",   "aaaBB",   "aaaBC"),
   [ ... etc ... ]
   ;

我的google-fu没有发现任何事情。这可能吗?

0 个答案:

没有答案