当前位置:网站首页>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)
边栏推荐
- The most complete regular expression summary in the whole network, so that you can get twice the result with half the effort. Collect it quickly
- What is a domain name address? What is the reason for using a domain name address?
- How novices choose ECs and how to judge the quality of ECS
- Understanding OAuth 2.0
- cuDNN installation
- API service orchestration platform, full web visual orchestration
- Deep learning NLP from RNN LSTM Gru seq2seq to attention classification and analysis
- PHP in_ Array() function
- PTA 1066 image filtering (15 points)
- How to apply for domain name space? Will it be difficult to apply for domain name space?
猜你喜欢

CTF learning notes 17:iwesec file upload vulnerability-02 file name filtering bypass

Leetcode (question 1) - sum of two numbers

Leetcode question brushing (question 3) - the longest substring without repeated characters
What cloud native knowledge should programmers master?

CTF learning notes 18:iwesec file upload vulnerability-03-content-type filtering bypass

How does win10 turn off f1~f12 shortcut keys?
Learning routes and materials for cloud native O & M engineers

Answer questions! This article explains the automated testing framework in software testing from beginning to end

011_ Cascader cascade selector

Leetcode (question 2) - adding two numbers
随机推荐
[latest offer] 2-core 4G server is limited to 188 yuan, and it is in the process of being snapped up
How Clickhouse queries imported data within a specified time period
How to set easycvr recording plan batch and single channel settings?
Redis pipeline technology speed and efficiency increased by 5 times
Use cloud functions to receive callbacks and cooperate with CLS to view callback logs and persistent storage
PHP ksort() function
How the query address of cloud native monitoring data exposes the public network
What kind of intelligent connection design do we need in an interconnected society?
How to register a company domain name how to build a website with a domain name
Share 10 creative projects of Gaoxing!
Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players
Build personal leanote cloud notebook with Tencent cloud lightweight application server
System design: index
Spirit breath development log (12)
[competition experience sharing] a problem-solving summary of the whole DFS (internal track)
Tencent cloud + community video [technology star push official] FAQ
Where is the cheaper domain name? What should I pay attention to when buying a domain name?
What kind of domain name is better? What should enterprises pay attention to when choosing a domain name?
PHP in_ Array() function
What domain name is cheap? How much does it cost to register a domain name?