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

How mysql deletes tables

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article is about how mysql deletes tables. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

In mysql, you can use the "DORP TABLE" statement to delete the data table in the general syntax format "DROP TABLE table_name;"; where "table_name" represents the name of the data table to be deleted, and you can specify multiple data table names, as long as they are separated by commas.

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

Deleting tables in MySQL is very easy to operate, but you have to be very careful when deleting tables, because all data will disappear after executing the delete command.

The following is the general syntax for deleting MySQL data tables:

DROP TABLE table_name

Table_name: represents the name of the data table to be deleted. DROP TABLE can delete multiple tables at the same time, as long as the table names are written after each other and separated by commas.

Example:

First look at the data table in the test_db database

Mysql > USE test_db;Database changedmysql > SHOW TABLES;+-+ | Tables_in_test_db | +-+ | tb_emp1 | | tb_emp2 | | tb_emp3 | +-+ 3 rows in set (0.00 sec)

If you want to delete the datasheet tb_emp2

Mysql > DROP TABLE tb_emp2;Query OK, 0 rows affected (0.22 sec) mysql > SHOW TABLES;+-+ | Tables_in_test_db | +-+ | tb_emp1 | | tb_emp3 | +-+ 2 rows in set (0.00 sec)

As can be seen from the execution result, the table named tb_emp2 no longer exists in the datasheet list of the test_db database, and the delete operation was successful.

Thank you for reading! This is the end of the article on "how to delete tables in mysql". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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