当前位置:网站首页>How does SQLite count the data that meets another condition under the data that has been classified once
How does SQLite count the data that meets another condition under the data that has been classified once
2022-07-06 14:25:00 【CSDN Q & A】
Data is a bunch of information about children , I'll count them by race first , Then I will count the number of sick children in each race .
Problem situation :
I think there is something wrong with the red line above me , But after trying for a long time, I don't know what's wrong .
I hope to achieve the effect like the following , Connect the two columns , Then calculate the ratio .
I hope some students can help solve it , thank you !
Take the answer :
This problem can be solved by case when Write for processing , The specific implementation can refer to the following code :
select Ethnicity,sum(case when [Class/ASDTraits] = "Yes" then 1 else 0 end ) -- Number of sick children ,count(*) -- The number of children of all ethnic groups ,sum(case when [Class/ASDTraits] = "Yes" then 1 else 0 end ) /count(*) --- Prevalence rate from ASDgroup by Ethnicity
边栏推荐
- Which is more advantageous in short-term or long-term spot gold investment?
- 7-9 make house number 3.0 (PTA program design)
- JDBC看这篇就够了
- 《统计学》第八版贾俊平第十章方差分析知识点总结及课后习题答案
- 7-4 hash table search (PTA program design)
- captcha-killer验证码识别插件
- JDBC read this article is enough
- HackMyvm靶机系列(5)-warez
- Callback function ----------- callback
- Intel oneapi - opening a new era of heterogeneity
猜你喜欢
Intranet information collection of Intranet penetration (5)
Mixlab unbounded community white paper officially released
JVM memory model concept
Strengthen basic learning records
Hackmyvm Target Series (3) - vues
Hackmyvm target series (2) -warrior
Only 40% of the articles are original? Here comes the modification method
强化學習基礎記錄
Intel oneapi - opening a new era of heterogeneity
Proceedingjoinpoint API use
随机推荐
HackMyvm靶机系列(6)-videoclub
【educoder数据库实验 索引】
Overview of LNMP architecture and construction of related services
JDBC事务、批处理以及连接池(超详细)
网络基础详解
JDBC transactions, batch processing, and connection pooling (super detailed)
C language file operation
Record an API interface SQL injection practice
The most popular colloquial system explains the base of numbers
【MySQL数据库的学习】
[MySQL table structure and integrity constraint modification (Alter)]
sqqyw(淡然点图标系统)漏洞复现和74cms漏洞复现
网络基础之路由详解
7-7 7003 combination lock (PTA program design)
Circular queue (C language)
HackMyvm靶機系列(3)-visions
JDBC看这篇就够了
Intranet information collection of Intranet penetration (2)
[experiment index of educator database]
内网渗透之内网信息收集(一)