添加许多具有递增值的行。 (填下来?)
我想向 MySQL 表添加 10,000 行。该表有一个字段,我们称之为“Number”,需要从 540000 增加到 549999。
这只是需要运行一次的内容,因此性能并不重要。是否有 MySQL 命令可以执行此操作,或者我是否需要编写一个脚本来调用 10,000 个插入语句?
I want to add 10,000 rows to a MySQL table. The table has a field, let's call it "Number", that needs to increment from 540000 to 549999.
This is just something that needs to run once, so performance is not critical. Is there a MySQL command that will do this, or do I need to write a script to call 10,000 insert statements?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您在制表符分隔的文件中有这 10,000 行,您可以将数据批量加载到表中并逐步设置 Number 值,如下所示:
Assuming you have those 10,000 rows in a tab-delimited file, you can bulk load the data into your table and set the Number value incrementally like this:
我最终创建了一个包含 10,000 个插入语句的脚本。
I ended up creating a script with 10,000 insert statements.