当前位置:网站首页>MySQL - 删除数据库表中的数据
MySQL - 删除数据库表中的数据
2022-07-24 10:25:00 【骆驼胡杨】
删除数据库表中的数据
- 删除数据记录是数据操作中常见的操作,可以删除表中已经存在的数据记录。在MySQL中可以通过DELETE语句来删除数据记录,该SQL语句可以通过以下几种方式使用:删除特定数据记录、删除所有数据记录。
1. 删除特定数据记录
在MySQL中删除特定数据记录可通过SQL语句DELETE来实现,其语法形式如下:
DELETE FROM tablename WHERE CONDITION;在上述语句中,参数tablename表示所要删除数据记录的表名,参数CONDITION指定删除满足条件的特定数据记录。
mysql> create table class(id int, name varchar(64)); mysql> insert into class values(1, '张三'); mysql> insert into class values(2, '李四'); mysql> delete from class where id=1; //删除表中id为1的记录 mysql> delete from class where name='李四'; //删除表中name为'李四'的记录 mysql> select * from class;
2. 删除所有数据记录
在MySQL中删除所有数据记录同样可通过SQL语句DELETE来实现,其语法形式如下:
DELETE FROM tablename WHERE CONDITION; 或 DELETE FROM tablename;在上述语句中,为了删除所有的数据记录,参数CONDITION需要满足表tablename中所有数据记录,如id>0; 或者无关键字WHERE语句。
mysql> create table class(id int, name varchar(64)); mysql> insert into class values(1, '张三'); mysql> insert into class values(2, '李四'); mysql> delete from class; //删除表中所有记录 mysql> select * from class;
边栏推荐
- OSPF含特殊区域实验,MGRE构建和重发布
- PostgreSQL rounding
- [STM32 learning] (11) STM32 Mifare_ Use of one (S50) m1s50 (read, write, key modification, control bit interpretation)
- Rust tokio:: task:: localset running mode
- The best time to buy and sell stocks Ⅲ (leetcode-123)
- pom文件dependency中的 scope用法
- Constant pointer, pointer constant
- Add a love power logo to your website
- Ribbon's loadbalancerclient, zoneawareloadbalancer and zoneavoidancerule are three musketeers by default
- Wechat applet
猜你喜欢

New:Bryntum Grid 5.1.0 Crack

Zoj1137+ operation 1 -- May 28, 2022

The concept and representation of a tree
![[STM32 learning] (6) use of serial port 1 (usart1)](/img/b1/430d3501a99e46958c066f7fd7eee9.png)
[STM32 learning] (6) use of serial port 1 (usart1)
![[STM32 learning] (17) STM32 realizes LCD12864 display serial implementation](/img/93/224eaf0bbfff1d38f29e063e6ebfb8.png)
[STM32 learning] (17) STM32 realizes LCD12864 display serial implementation
![[STM32 learning] (7) use of serial port 2 (usart2)](/img/e8/7a01cb2753f448d745e0d8712b3ebc.png)
[STM32 learning] (7) use of serial port 2 (usart2)
![[STM32 learning] (15) STM32 realizes DHT11 temperature and humidity acquisition and display](/img/f2/6fcd4b2e747b4ceb52a52eda0c1af4.png)
[STM32 learning] (15) STM32 realizes DHT11 temperature and humidity acquisition and display

Constant pointer, pointer constant

Will not be rejected! Learn the distributed architecture notes sorted out by Alibaba Daniel in 35 days, with a salary increase of 20K

Query about operating system security patch information
随机推荐
NiO knowledge points
Sentinel 三种流控模式
Golang migrate is easy to use
Onpropertychange event "suggestions collection"
[STM32 learning] (10) stm32f1 general timer realizes pulse counter
A ten thousand word blog post takes you into the pit. Reptiles are a dead end [ten thousand word pictures]
String__
2022, will lead the implementation of operation and maintenance priority strategy
Figure model 2-2022-5-13
How does ribbon get the default zoneawareloadbalancer?
Segment tree--
Nirvana rebirth! Byte Daniel recommends a large distributed manual, and the Phoenix architecture makes you become a God in fire
Simply use golang SQLC to generate MySQL query code
In depth analysis of common cross end technology stacks of app
常量指针、指针常量
The best time to buy and sell stocks includes handling charges (leetcode-714)
脚手架内各文件配置说明、组件化开发步骤
OSPF含特殊区域实验,MGRE构建和重发布
CMS vulnerability recurrence - ultra vires vulnerability
Programmers can't JVM? Ashes Engineer: all waiting to be eliminated! This is a must skill!