当前位置:网站首页>9. Learn MySQL delete statement
9. Learn MySQL delete statement
2022-07-26 14:49:00 【Microservice spring cloud】
MySQL DELETE sentence
You can use SQL Of DELETE FROM Command to delete MySQL Records in the data table .
You can mysql> Command prompt or PHP Execute the command in the script .
grammar
Here are SQL DELETE Statements from MySQL General syntax for deleting data from a data table :
DELETE FROM table_name [WHERE Clause]- If not specified WHERE Clause ,MySQL All records in the table will be deleted .
- You can WHERE Clause to specify any condition
- You can delete records once in a single table .
When you want to delete the record specified in the data table WHERE Clause is very useful .
Delete data from the command line
So here we're going to be SQL DELETE Use in command WHERE Clause to delete MySQL Data sheet xxxxxx_tbl Selected data . Friends who need the framework source code can see my personal profile and contact me .

example
The following examples will be deleted xxxxxx_tbl In the table xxxxxx_id by 3 The record of :
DELETE sentence :
mysql> use XXXXXX;
Database changed
mysql> DELETE FROM xxxxxx_tbl WHERE xxxxxx_id=3;
Query OK, 1 row affected (0.23 sec)Use PHP Script delete data
PHP Use mysqli_query() Function to execute SQL sentence , You can SQL DELETE Command with or without WHERE Clause .
The function and mysql> Command execution SQL The effect of the command is the same .
example
following PHP Instance will be deleted xxxxxx_tbl In the table xxxxxx_id by 3 The record of :
MySQL DELETE Clause test :
<?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));
}
// Set encoding , Prevent Chinese miscoding
mysqli_query($conn , "set names utf8");
$sql = 'DELETE FROM xxxxxx_tbl
WHERE xxxxxx_id=3';
mysqli_select_db( $conn, 'XXXXXXX' );
$retval = mysqli_query( $conn, $sql );
if(! $retval )
{
die(' Unable to delete data : ' . mysqli_error($conn));
}
echo ' Data deletion successful !';
mysqli_close($conn);
?>边栏推荐
- Tips for unity transparent channel
- BSN IPFs (interstellar file system) private network introduction, functions, architecture and characteristics, access instructions
- 9、学习MySQL DELETE 语句
- Stacked noise reducing auto encoder (sdae)
- 图神经网络Core数据集介绍
- RPN:Region Proposal Networks (区域候选网络)
- VBA 上传图片
- Simple implementation of pytorch
- Pdf translation, which translation company in Beijing is good
- Siamrpn++: evolution of deep network connected visual tracking
猜你喜欢

C# 常用功能整合

What is the problem of the time series database that has been developed for 5 years?

【无标题】

WPF common function integration

Seata deployment and microservice integration

SiamRPN++:深层网络连体视觉跟踪的演变

Tdengine helps Siemens' lightweight digital solution simicas simplify data processing process

中值滤波器

《MySQL高级篇》五、InnoDB数据存储结构

【方差分析】之matlab求解
随机推荐
智能家居行业发展,密切关注边缘计算和小程序容器技术
Brief description of llcc68 broadcast wake-up
Summary and analysis of image level weakly supervised image semantic segmentation
【干货】MySQL索引背后的数据结构及算法原理
[2022 national game simulation] Bai Loujian - Sam, rollback Mo team, second offline
CAS单点登录
什么是传输层协议TCP/UDP???
Siamrpn: recommended regional network and twin network
Self encoder AE (autoencoder) program
Mysql-03 database operation
Unity learning notes – infinite map
unity透明通道的小技巧
Create root permission virtual environment
C# Winfrom 常用功能整合
14. Bridge based active domain adaptation for aspect term extraction reading notes
PyTorch中 nn.Conv2d与nn.ConvTranspose2d函数的用法
Transc knowledge representation model
AMB | towards sustainable agriculture: rhizosphere microbial engineering
Pdf translation, which translation company in Beijing is good
《MySQL高级篇》五、InnoDB数据存储结构