4.2.11. MySQL delete data table

发布时间 : 2025-10-25 13:32:48 UTC      

Page Views: 10 views

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.

Grammar

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

DROP TABLE table_name ; 

Delete the datasheet in the command prompt window

In the mysql > command prompt window, delete the data table SQL statement is DROP TABLE :

Example

The following example deletes the data table runoob_tbl :

root@host# mysql -u root -p Enter password:******* mysql> use RUNOOB; Database changed mysql> DROP TABLE runoob_tbl; Query OK, 0 rows affected (0.8 sec) mysql> 

Use the PHP script to delete the data table

PHP usage mysqli_query Function to delete the MySQL data table.

This function takes two arguments and returns TRUE on successful execution, or FALSE otherwise.

Grammar

mysqli_query(connection,query,resultmode); 

Parameters.

Description

connection

Necessary. Specifies the MySQL connection to be used.

query

Required, specify the query string.

resultmode

Optional. A constant. It can be any of the following values:

  • MYSQLI_USE_RESULT(如果需要检索大量数据,请使用这个)

  • MYSQLI_STORE_RESULT(默认)

Example

The following example uses a PHP script to delete a data table runoob_tbl :

Delete database

';$sql="DROP TABLE runoob_tbl";mysqli_select_db($conn,'RUNOOB');$retval=mysqli_query($conn,$sql);if(!$retval){die('数据表删除失败:'.mysqli_error($conn));}echo"数据表删除成功\\n";mysqli_close($conn);?> 

After the execution is successful, we will not see it when we use the following command runoob_tbl Table:

mysql> show tables; Empty set (0.01 sec) 
《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。