开发者

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

开发者 https://www.devze.com 2022-12-29 14:39 出处:网络
Under the structure tab, when EXPORTing a 开发者_高级运维database using phpmyadmin there is a check box labeled:

Under the structure tab, when EXPORTing a 开发者_高级运维database using phpmyadmin there is a check box labeled:

Add DROP TABLE / VIEW / PROCEDURE / FUNCTION What does this do?


When creating a table, view, procedure, or function, it will add a DROP statement before it. 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. 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. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消