当前位置:网站首页>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
边栏推荐
- Yyds dry goods inventory OSI & tcp/ip
- 也算是学习中的小总结
- 力扣(LeetCode)186. 翻转字符串里的单词 II(2022.07.05)
- Visio draw fan
- 关于es8316的音频爆破音的解决
- The IPO of mesk Electronics was terminated: Henan assets, which was once intended to raise 800 million yuan, was a shareholder
- Request (request object) and response (response object)
- Basic knowledge and examples of binary tree
- Can CDC pull the Oracle table in full
- Microservice resource address
猜你喜欢
Selection of slow motion function
Visio draw fan
A blog to achieve embedded entry
ISP learning (2)
Postman pre script - global variables and environment variables
RT thread analysis log system RT_ Kprintf analysis
Postman关联
Orm-f & Q object
Introduction of several RS485 isolated communication schemes
MPLS experiment
随机推荐
What should the project manager do if there is something wrong with team collaboration?
Leetcode dynamic planning day 16
Drive development - the first helloddk
ISP learning (2)
RTP gb28181 document testing tool
How does vs change the project type?
Postman pre script - global variables and environment variables
项目经理,你会画原型嘛?项目经理需要做产品设计了?
Postman test report
[buuctf.reverse] 159_[watevrCTF 2019]Watshell
MPLS experiment
二叉树基本知识和例题
Flink kakfa data read and write to Hudi
The web project imported the MySQL driver jar package but failed to load it into the driver
Leetcode 186 Flip the word II in the string (2022.07.05)
【LGR-109】洛谷 5 月月赛 II & Windy Round 6
Redis 排查大 key 的4種方法,優化必備
How to estimate the population with samples? (mean, variance, standard deviation)
Supreme Court, judgment standard of divorce cases
C'est un petit résumé de l'étude.