我目前正在学习用于数据分析的SQL。在今天的练习中,我必须回答以下问题:
*2015 年,按世界地区划分,有多少人达到官方规定的中等教育年龄? 对于此查询,您需要在返回结果之前执行一些额外的任务:
现在我的问题是:如何在包含数千个条目的列中找到正确的名称?回答“有多少人达到中等教育的官方年龄”的问题
我们收到了这篇文章“中等教育的官方年龄人口,男女(数字)”。但如果没有给我怎么找到呢?
Hier ist der Code den ich geschrieben hatte:
SELECT
summary.region,
SUM(edu.value) AS secondary_edu_population
FROM
`bigquery-public-data.world_bank_intl_education.international_education` AS edu
INNER JOIN
`bigquery-public-data.world_bank_intl_education.country_summary` AS summary
ON edu.country_code = summary.country_code
WHERE
summary.region IS NOT NULL
-- here is the problem-- AND edu.indicator_name = 'Population of the official age for secondary education, both sexes (number)'
AND edu.year = 2015
GROUP BY summary.region
ORDER BY secondary_edu_population DESC
听起来你的表有如下列: 地区年份指标值
如果您只需要获取所有指标的名称以便找到所需的指标,那么
select distinct indicator
from yourtable
会做到的。如果您知道指标名称可能是什么,那么您可以缩小范围:
select distinct indictaor
from yourtable
where indicator like '%education%'