mysql delete 多表连接删除功能
作者:qq_36801966 时间:2024-01-21 15:02:41
单个表的删除:
DELETE FROM tableName WHERE columnName = value;
删除表内的所有行:
即:保留表的结构、属性、索引
DELETE FROM tablename;
DELETE * FROM tablename;
删除同一张表内的所有内容(删除数据、表结构)
TRUNCATE customer;
无法报告删除了几行,且只能用于单一表
多表连接删除:
DELETE orders,itrms FROM orders,items
WHERE orders.userid = items.userid
AND orders.orderid = items.orderid
AND orders.date<"2000/03/01";
需要删除的表的名称列在DELETE之后,连接条件所用的表列在FROM之后
假设删除BV地区的所有葡萄酒场,但不删除地名
DELETE winery FROM region,winery
WHERE winery.regionid = region.regionid
AND region.regionname = 'BV';
查询只影响winery表,但同时利用winery,region找出需要删除的记录
使用高级连接查询
DELETE orders,items FROM orders
INNER JOIN otems ON orders.orderid = items.orderid
AND orders.userid = items.userid
WHERE orders.date<"2000/03/01";
也可在DELETE语句中使用嵌套查询(内部查询不可引用删除的数据)、GROUP BY、HAVING;
也可在单一表查询中使用ORDER BY,单数除非与LIMIT连用删除部分数据行,否则并无太大意义。
加quick修饰符,可快速删除索引项,加速大量或者频繁的删除操作
DELETE QUICK FROM customer WHERE userid<10;
只可用于类型为MyISAM的表
清理MyISAM的表
OPTIMIZE TABLE customer;
以上所述是小编给大家介绍的mysql delete 多表连接删除功能网站的支持!
来源:http://blog.csdn.net/qq_36801966/article/details/60780277
标签:mysql,delete,删除
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python深度学习神经网络基本原理
2023-05-08 20:20:32
![](https://img.aspxhome.com/file/2023/5/133885_0s.png)
教你如何使用Python实现二叉树结构及三种遍历
2021-04-30 14:08:00
![](https://img.aspxhome.com/file/2023/1/133321_0s.png)
Mysql存储过程学习笔记--建立简单的存储过程
2024-01-23 14:41:21
![](https://img.aspxhome.com/file/2023/0/71120_0s.png)
用mysql做站点时怎样记录未知错误的发生
2009-01-14 13:16:00
python中的变量命名规则详情
2022-05-25 17:49:06
python实现图片插入文字
2021-11-02 20:32:09
![](https://img.aspxhome.com/file/2023/7/120417_0s.jpg)
python语言使用技巧分享
2022-10-24 09:29:38
![](https://img.aspxhome.com/file/2023/1/101501_0s.png)
影响SEO的页面制作细节
2008-10-18 16:06:00
手把手教会你双目摄像头Matlab参数定标
2022-02-11 16:31:44
![](https://img.aspxhome.com/file/2023/0/134680_0s.png)
python中csv文件创建、读取及修改等操作实例
2023-07-31 23:22:25
![](https://img.aspxhome.com/file/2023/2/78502_0s.png)
如何让python的运行速度得到提升
2023-04-26 21:48:35
Mysql分库分表之后主键处理的几种方法
2024-01-20 21:00:09
![](https://img.aspxhome.com/file/2023/8/128438_0s.png)
巧妙规划使用Oracle数据空间
2009-03-20 11:51:00
Python爬虫实例爬取网站搞笑段子
2022-11-29 17:14:33
pytorch fine-tune 预训练的模型操作
2023-05-02 01:05:25
![](https://img.aspxhome.com/file/2023/2/87892_0s.png)
bootstrap table 服务器端分页例子分享
2024-04-29 13:12:15
Vue用v-for给循环标签自身属性添加属性值的方法
2024-04-10 10:30:56
![](https://img.aspxhome.com/file/2023/3/139773_0s.png)
python网络编程:socketserver的基本使用方法实例分析
2023-11-26 21:33:50
![](https://img.aspxhome.com/file/2023/0/75280_0s.png)
Python判断三段线能否构成三角形的代码
2023-01-21 19:44:25
关于H1的位置
2008-04-30 12:20:00