<Kaggle-Course>

캐글​ intro_to_sql/04-order-by

9566 2023. 3. 15. 15:35
728x90
code_count_query = """
    SELECT indicator_code, indicator_name, COUNT(1) AS num_rows
      FROM `bigquery-public-data.world_bank_intl_education.international_education`
      WHERE year = 2016
      GROUP BY indicator_code, indicator_name
      HAVING num_rows >= 175
      ORDER BY num_rows DESC
"""​
country_spend_pct_query = """
  SELECT country_name, AVG(value) AS avg_ed_spending_pct
    FROM `bigquery-public-data.world_bank_intl_education.international_education`
    WHERE indicator_code = 'SE.XPD.TOTL.GD.ZS' 
      AND year BETWEEN 2010 AND 2017
    GROUP BY country_name
    ORDER BY avg_ed_spending_pct DESC
"""
728x90