当前位置:网站首页>MySQL - delete data in database tables
MySQL - delete data in database tables
2022-07-24 10:31:00 【Camellia Populus】
Delete the data in the database table
- Deleting data records is a common operation in data operations , You can delete existing data records in the table . stay MySQL Through DELETE Statement to delete data records , The SQL Statements can be used in the following ways : Delete specific data records 、 Delete all data records .
1. Delete specific data records
stay MySQL You can delete specific data records through SQL sentence DELETE To achieve , Its grammatical form is as follows :
DELETE FROM tablename WHERE CONDITION;In the above statement , Parameters tablename Indicates the table name of the data record to be deleted , Parameters CONDITION Specify to delete specific data records that meet the conditions .
mysql> create table class(id int, name varchar(64)); mysql> insert into class values(1, ' Zhang San '); mysql> insert into class values(2, ' Li Si '); mysql> delete from class where id=1; // Delete... From the table id by 1 The record of mysql> delete from class where name=' Li Si '; // Delete... From the table name by ' Li Si ' The record of mysql> select * from class;
2. Delete all data records
stay MySQL You can also delete all data records in SQL sentence DELETE To achieve , Its grammatical form is as follows :
DELETE FROM tablename WHERE CONDITION; or DELETE FROM tablename;In the above statement , To delete all data records , Parameters CONDITION Need to meet table tablename All data records in , Such as id>0; Or no keywords WHERE sentence .
mysql> create table class(id int, name varchar(64)); mysql> insert into class values(1, ' Zhang San '); mysql> insert into class values(2, ' Li Si '); mysql> delete from class; // Delete all records in the table mysql> select * from class;
边栏推荐
猜你喜欢

Analysis of distributed lock redistribution principle

高精尖中心论文入选国际顶会ACL 2022,进一步拓展长安链隐私计算能力

PC博物馆(2) 1972年 HP-9830A

563页(30万字)智慧化工园区(一期)总体设计方案

MySQL - 索引的隐藏和删除

Websocket 协议解读-RFC6455

zoj 2770 差分约束系统---2--2022年5月20日

The paper of gaojingjian center was selected into the ACL 2022 of the international summit to further expand the privacy computing capacity of Chang'an chain

MySQL - lock

NiO knowledge points
随机推荐
NiO knowledge points
2022, will lead the implementation of operation and maintenance priority strategy
ZOJ 2770 differential restraint system -- 2 -- May 20, 2022
Sentinel implements the persistence of pull pattern rules
How to build a node development environment efficiently
Uniapp uses PWA
Knapsack problem of dynamic programming -- three lectures on knapsack (01 knapsack, complete knapsack, multiple knapsack)
脚手架内各文件配置说明、组件化开发步骤
Web Security Foundation - file upload (file upload bypass)
Activity exception lifecycle
563页(30万字)智慧化工园区(一期)总体设计方案
ECCV 2022 | 清华提出首个嵌入光谱稀疏性的Transformer
Set scrolling for the box
Kotlin advanced
PyTorch 常用 Tricks 总结
Add a love power logo to your website
JS function call download file link
The best time to buy and sell stocks (leetcode-121)
Query about operating system security patch information
js函数调用下载文件链接