当前位置:网站首页>Deleting a data table in a command prompt window
Deleting a data table in a command prompt window
2022-06-24 05:21:00 【User 4988376】
MySQL It's very easy to delete a data table in , But you should be very careful when deleting tables , Because after executing the delete command, all data will disappear .
grammar
Here is the deletion MySQL General syntax for data tables :
DROP TABLE table_name ;
Delete the data table in the command prompt window
stay mysql> Delete the data table in the command prompt window SQL Statement for DROP TABLE :
example
The following example deletes the data table runoob_tbl:
[email protected]# 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 PHP Script delete data table
PHP Use mysqli_query Function to delete MySQL Data sheet .
This function takes two arguments , Returns... On successful execution TRUE, Otherwise return to FALSE.
grammar
mysqli_query(connection,query,resultmode);
Parameters | describe |
|---|---|
connection | It's necessary . Stipulate what to use MySQL Connect . |
query | It's necessary , Specify the query string . |
resultmode | Optional . A constant . It can be any of the following values :MYSQLI_USE_RESULT( If you need to retrieve a lot of data , Please use this )MYSQLI_STORE_RESULT( Default ) |
- MYSQLI_USE_RESULT( If you need to retrieve a lot of data , Please use this )
- MYSQLI_STORE_RESULT( Default )
example
The following example uses PHP Script delete data table runoob_tbl:
Delete database
<?php
$dbhost = 'localhost'; // mysql Server host address
$dbuser = 'root'; // mysql user name
$dbpass = '123456'; // mysql User name, password
$conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die(' The connection fails : ' . mysqli_error($conn));
}
echo ' Successful connection <br />';
$sql = "DROP TABLE runoob_tbl";
mysqli_select_db( $conn, 'RUNOOB' );
$retval = mysqli_query( $conn, $sql );
if(! $retval )
{
die(' Data table deletion failed : ' . mysqli_error($conn));
}
echo " Data table deleted successfully \n";
mysqli_close($conn);
?>
mysql> show tables; Empty set (0.01 sec)
边栏推荐
- PTA 1082 shooting competition (20 points)
- [latest offer] 2-core 4G server is limited to 188 yuan, and it is in the process of being snapped up
- System design: Agent & redundancy & replication
- Zero code implements one-to-one table relationship and cascading save of infinite primary and child tables
- What domain name does not need to be filed? What should be done for domain name filing
- 2021-08-27: the normal odometer will display natural numbers in turn to indicate mileage, Kyrgyzstan
- Spirit breath development log (11)
- What is domain name filing? What is the role of domain name filing?
- What is the difference between a traditional data center and a cloud computing data center?
- The personal information protection law was passed today. What problems should enterprises pay attention to?
猜你喜欢

Leetcode (question 2) - adding two numbers

What are the disadvantages of the free IP address replacement tool?

How does win10 turn off f1~f12 shortcut keys?
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players

Leetcode question brushing (question 3) - the longest substring without repeated characters
Easy to understand JDBC tutorial - absolutely suitable for zero Foundation

014_ TimePicker time selector

How should we learn cloud native in 2022?

011_ Cascader cascade selector
随机推荐
Answer questions! This article explains the automated testing framework in software testing from beginning to end
Blackmail virus prevention guide
How to register a first level domain name what is a first level domain name
What's wrong with the failure of uploading web pages to ECS? How many kinds of servers are there
[competition experience sharing] [Tencent internal track rank6] goose Rose Square half hand (TAS) experience
[the lottery in June has ended, and the list of winners has been announced] special cloud development session of techo Youth College Open Class
Tencent cloud + community video [technology star push official] FAQ
Spirit breath development log (11)
Shuttle global levitation button
Use of go testing framework gomock
PHP key() function
How to apply for a domain name for free? What is the importance of domain names?
Panoramic recording, WYSIWYG new recording scheme, and exclusive preferential resource package as low as 1 yuan!
Is it useful to build an industrial knowledge map platform?
How to apply for domain name space? Will it be difficult to apply for domain name space?
PHP krsort() function
API service orchestration platform, full web visual orchestration
Hard core JS: there may be a memory leak in your program
Lightweight toss plan 3, develop in the browser - build your own development bucket (Part 2)
What domain name does not need to be filed? What should be done for domain name filing