Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of changing table name and deleting table by mysql

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to change the table name and delete the table by mysql". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "mysql table name modification and delete table method" it!

1. Modify the table name in the sql statement to modify the table name when using mysql, it is often encountered that the table name does not conform to the specification or standard, but there is already a large amount of data in the table, how to retain the data and only change the table name? ALTER TABLE table_name RENAME TO new_table_name such as ALTER TABLE admin_user RENAME TO a_user

2. Delete table drop table shili. In the process of deleting a table that does not exist, an error will occur if you delete a table that does not exist. If you add the IF EXISTS keyword to the delete statement, you can avoid the error. The format is as follows: drop table if exists students

The following example shows that if you want to delete the table at the beginning of "wp_": Select CONCAT ('drop table', table_name,';) FROM information_schema.tables Where table_name LIKE 'wp_%';, then all the statements of drop table wp_xxxx will appear. Copy it, simply modify it, and paste it into the command line to run it.

At this point, I believe that everyone on the "mysql table name modification and delete table method" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report