当前位置:网站首页>Where, having, group by, order by, is null, not in, subquery, delete, date function
Where, having, group by, order by, is null, not in, subquery, delete, date function
2022-07-29 02:35:00 【Meme_ xp】
where
Filter conditions , use and,or,not Equal operator separation
If necessary at the same time and and or What shall I do? ? Parentheses are grouped
from Table name
where(…)
or(…)
having and group by
group by grouping ,having Filter conditions
group by …
having …
order by
Default ascending order
order Name desc For the descending order
order by a,b,c;
a,b,c The order of determines the order of sorting
Sort by location instead of by name
order by 3 descs( In descending order with the third column )
Judge null
I used left join query , Learned that only IS NULL or IS NOT NULL, Can't use =, <, <>, != These operators are used to judge NULL.
not in
Use not in Find out the data that is not in these results .
select name from customers where id not in (
select customerId from orders
);
Subquery

1.select Subquery 
2.where Subquery , If it is a set, it cannot be used =, And we should use in


3.from Subquery , For more than three tables
a,b,c Three tables , First check ab, The query again c
delete
Single table delete

Multi table delete :
delete p1 from Person p1 ,Person p2
where p1.Email =p2.Email and p1.Id > p2.Id Multi table delete , hold p1 Greater than p2 Of ID Deleted
datediff
DATEDIFF Is the difference set of days between two dates
DATEDIFF(expr1,expr2)
DATEDIFF() return expr1 − expr2, Expressed as a value in days from one date to another .expr1 and expr2 It's a date or a date and time expression . Only the date part of the value is used in the calculation .
mysql> SELECT DATEDIFF(‘2007-12-31 23:59:59’,‘2007-12-30’); -> 1
mysql> SELECT DATEDIFF(‘2010-11-30 23:59:59’,‘2010-12-31’); -> -31
边栏推荐
- Explain asynchronous tasks in detail: task status and lifecycle management
- 代码随想录笔记_哈希_349两个数的交集
- MySQL basic operation and comprehensive instance project based on MySQL basic operation
- 响应式织梦模板家装装饰类网站
- Never pass a request to an asynchronous thread. There is a hole
- 多边形点测试
- 响应式织梦模板户外露营类网站
- Responsive dream weaving template outdoor camping website
- Explanation of engineering economics terms
- “两个披萨”团队的分支管理实践
猜你喜欢

Practice and experience of security compliance in instant messaging scenarios

如何快速设计一套支持渲染富文本内容的跨端组件

ES6事件绑定(v-on用法)

Responsive dream weaving template makeup website

Day 15 (VLAN related knowledge)

Altium designer outputs Gerber and other production documents

Servlet三种实现方式
![[RT learning note 1] RT thread peripheral routine - control LED light flashing](/img/70/2c8cebd98948b5c92625c1a5423d97.png)
[RT learning note 1] RT thread peripheral routine - control LED light flashing

一文搞懂 Redis 架构演化之路

QT qstackedwidget multi interface switching
随机推荐
Prometheus + AlertManager 消息预警
会议OA之会议通知
DevOps 团队如何抵御 API 攻击?
The financing demand of 129 million yuan was released, and the roadshow of the Dake city project continued to irrigate the "good seedlings" of scientific innovation
Meeting notice of meeting OA
深度剖析 —— 预处理
Experiment 2: Arduino's tricolor lamp experiment
如何利用 RPA 实现自动化获客?
How awesome is the architecture of "12306"?
Responsive dream weaving template outdoor camping website
MySQL驱动中关于时间的坑
[mqtt from introduction to improvement series | 09] Wireshark packet capturing and analyzing mqtt messages
[golang learning notes 2.2] map, structure and interface
快速掌握Nodejs安装以及入门
聊聊 Feign 的实现原理
What should I do if excel opens a CSV file containing Chinese characters and there is garbled code?
Rust 列表(Vec)复制
Brief answer of Engineering Economics
防止勒索软件攻击数据的十种方法
time_wait和close_wait产生原因