当前位置:网站首页>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边栏推荐
- 《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
- Intranet information collection of Intranet penetration (2)
- Network technology related topics
- Internet Management (Information Collection)
- The most popular colloquial system explains the base of numbers
- 中间件漏洞复现—apache
- 安全面试之XSS(跨站脚本攻击)
- JDBC read this article is enough
- 7-6 local minimum of matrix (PTA program design)
- Hackmyvm target series (1) -webmaster
猜你喜欢

7-7 7003 combination lock (PTA program design)

HackMyvm靶机系列(4)-vulny

Hackmyvm target series (2) -warrior

内网渗透之内网信息收集(二)

Constants, variables, and operators of SystemVerilog usage

强化学习基础记录

内网渗透之内网信息收集(五)

Low income from doing we media? 90% of people make mistakes in these three points

Hackmyvm target series (6) -videoclub

Wei Shen of Peking University revealed the current situation: his class is not very good, and there are only 5 or 6 middle-term students left after leaving class
随机推荐
Build domain environment (win)
记一次api接口SQL注入实战
7-1 output all primes between 2 and n (PTA programming)
Interpretation of iterator related "itertools" module usage
Strengthen basic learning records
Binary search tree concept
内网渗透之内网信息收集(四)
7-3 construction hash table (PTA program design)
Record an API interface SQL injection practice
Hackmyvm target series (7) -tron
Sqqyw (indifferent dot icon system) vulnerability recurrence and 74cms vulnerability recurrence
Experiment 7 use of common classes (correction post)
What language should I learn from zero foundation. Suggestions
网络层—简单的arp断网
Record once, modify password logic vulnerability actual combat
[three paradigms of database] you can understand it at a glance
The United States has repeatedly revealed that the yield of interest rate hiked treasury bonds continued to rise
An unhandled exception occurred when C connected to SQL Server: system Argumentexception: "keyword not supported:" integrated
记一次edu,SQL注入实战
Intel oneapi - opening a new era of heterogeneity