当前位置:网站首页>MySQL if and ifnull use
MySQL if and ifnull use
2022-07-06 04:54:00 【Data analysis of financial Xiaobai】
SELECT age_range,count(*) FROM
(SELECT IF(IFNULL(age,0)>=25,"25 Years old and over ","25 Under the age of ") as age_range,device_id FROM user_profile) AS user_profile
GROUP BY age_range
SELECT IF(IFNULL(age,0)>=25,"25 Years old and over ","25 Under the age of ") as age_range,count(*) FROM user_profile GROUP BY age_range
SELECT device_id,gender,
CASE
WHEN age<20 then '20 Under the age of '
WHEN age<25 then '20-24 year '
WHEN age>=25 then '25 Years old and over '
else ' other '
END as age_cunt
FROM user_profile
边栏推荐
- ue5 小知识点 开启lumen的设置
- Basic knowledge and examples of binary tree
- 行业专网对比公网,优势在哪儿?能满足什么特定要求?
- How does vs change the project type?
- Summary of redis AOF and RDB knowledge points
- Redis 排查大 key 的4种方法,优化必备
- Fuzzy -- basic application method of AFL
- Lepton 无损压缩原理及性能分析
- MySQL reported an error datetime (0) null
- 团队协作出了问题,项目经理怎么办?
猜你喜欢
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
从0到1建设智能灰度数据体系:以vivo游戏中心为例
Postman manage test cases
yolov5 tensorrt加速
Basic explanation of turtle module - draw curve
Use sentinel to interface locally
How to estimate the population with samples? (mean, variance, standard deviation)
acwing周赛58
Leetcode dynamic planning day 16
idea一键导包
随机推荐
Visio draws Tai Chi
Selection sort
Word cover underline
Chip debugging of es8316 of imx8mp
IPv6 comprehensive experiment
Lepton 无损压缩原理及性能分析
Uva1592 Database
How to estimate the population with samples? (mean, variance, standard deviation)
Distributed transaction solution
Postman manage test cases
【Try to Hack】john哈希破解工具
[lgr-109] Luogu may race II & windy round 6
[try to hack] John hash cracking tool
Selection of slow motion function
树莓派3.5寸屏幕白屏显示连接
Biscuits (examination version)
2021 robocom world robot developer competition - undergraduate group (semi-finals)
Programmers' position in the Internet industry | daily anecdotes
[Chongqing Guangdong education] engineering fluid mechanics reference materials of southwestjiaotonguniversity
关于Unity Inspector上的一些常用技巧,一般用于编辑器扩展或者其他