简体   繁体   English

phpmyadmin 中的“添加 DROP TABLE / VIEW / PROCEDURE / FUNCTION”复选框有什么作用

[英]What does the "Add DROP TABLE / VIEW / PROCEDURE / FUNCTION" checkbox do in phpmyadmin

Under the structure tab, when EXPORTing a database using phpmyadmin there is a check box labeled:在结构选项卡下,使用phpmyadmin导出数据库时,有一个标记为:
Add DROP TABLE / VIEW / PROCEDURE / FUNCTION What does this do? Add DROP TABLE / VIEW / PROCEDURE / FUNCTION这是做什么的?

When creating a table, view, procedure, or function, it will add a DROP statement before it.在创建表、视图、过程或函数时,它会在其前面添加一个DROP语句。 The result of this is that even if the item exists, it will still be created.这样做的结果是,即使该项目存在,它仍然会被创建。

For example: If you have a table called users and you run the export script without the DROP checkbox, it will attempt to create the users table again but will fail since it already exists.例如:如果您有一个名为users的表,并且您在没有DROP复选框的情况下运行导出脚本,它将尝试再次创建users表,但由于它已经存在而失败。 If you check it, it will drop the table before it is created (if it exists) to ensure the creation will always be successful.如果选中它,它会在创建表之前将其删除(如果存在),以确保创建始终成功。

Of course this can be dangerous if you have data in the table that you don't want to lose.当然,如果表中有不想丢失的数据,这可能会很危险。

For example: If you have a table called users and you run the export script without the DROP checkbox, it will attempt to create the users table again but will fail since it already exists.例如:如果您有一个名为 users 的表,并且您在没有 DROP 复选框的情况下运行导出脚本,它将尝试再次创建 users 表,但由于它已经存在而失败。 If you check it, it will drop the table before it is created (if it exists) to ensure the creation will always be successful.如果选中它,它会在创建表之前将其删除(如果存在),以确保创建始终成功。

I was confused as to what this statement meant exactly, so I did additional research on the topic and wanted to leave an elaborated explanation here for future reference.我对这句话的确切含义感到困惑,所以我对该主题进行了额外的研究,并想在这里留下一个详细的解释以供将来参考。

The create and drop actions in the above quote are simply instructions for when you import the file you have already exported.上面引用中的创建和删除操作只是导入已导出文件时的说明。 I was initially under the impression that these actions were happening as I was exporting.我最初的印象是这些操作是在我导出时发生的。 This is not the case.不是这种情况。 It's simply instructions for when you import your exported file.它只是导入导出文件时的说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM