MySQL Workbench Inserts

若如初见. 提交于 2019-12-07 03:06:39

问题


I am using MySQL Workbench 5.2.28 for designing my database schema. I need to insert default data into some tables which can be done using the "Inserts" tab. However, it seems like it only allows entering data manually, one row at a time. I have an OUTFILE with several hundred rows that I would like to insert.

Is this possible with MySQL Workbench? Would creating separate MySQL scripts for importing default data be a better approach?


回答1:


I am now using separate sql scripts for inserting my data as there doesn't seem to be an easy way to add bulk inserts to MySQL workbench.




回答2:


Generate CSV (quoted if you have comas in values) in Excel for example, then just copy/paste all rows into workbench via 'inserts' tab for each table in model. Works with Workbench version 5.2.40.




回答3:


In the MySQL Workbench Version 6.2 you will find a Import Button which alows you to Import Inserts from a CSV File with "," as delemiter.




回答4:


You are right there is no way I know doing this automatically. The only thing you can do is to generate all your inserts scripts in a single time by doing a forward engeniering and then by copying the insert statements at the end of the generated script (You must check the option "Generate INSERT statements").



来源:https://stackoverflow.com/questions/6279058/mysql-workbench-inserts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!