World Bank: Education Data

How to query public data sets using BigQuery

BigQuery is a fully managed data warehouse and analytics platform. Public datasets are available for you to analyze using SQL queries. You can access BigQuery public data sets using the web UI the command-line tool, or by making calls to the BigQuery REST API using a variety of client libraries such as Java, .NET, or Python.

To get started using a BigQuery public dataset, create or select a project. The first terabyte of data processed per month is free, so you can start querying public datasets without enabling billing. If you intend to go beyond the free tier, you should also enable billing.

  1. Sign in to your Google account.

    If you don't already have one, sign up for a new account.

  2. Select or create a Cloud Platform project.

    Go to the Manage resources page

  3. Enable billing for your project.

    Enable billing

  4. BigQuery is automatically enabled in new projects. To activate BigQuery in a pre-existing project, Enable the BigQuery API.

    Enable the API

Dataset overview

This dataset combines key education statistics from a variety of sources to provide a look at global literacy, spending, and access.

For more information, see the World Bank website.

You can start exploring this data in the BigQuery console:

Go to World Bank education data

Sample queries

Here are some examples of SQL queries you can run on this data in BigQuery.

These samples use BigQuery’s support for standard SQL. Use the #standardSQL tag to let BigQuery know you want to use standard SQL. For more information about the #standardSQL prefix, see Setting a query prefix.

Of total government spending, what percentage is spent on education?

This query retrieves government spending on education from the year 2000 to the present. This range ensures enough countries are represented (reporting can be sparse), and it smooths any inconsistencies in the data.

Web UI

Open the following query in the Web UI

#standardSQL
SELECT
  country_name,
  AVG(value) AS average
FROM
  `bigquery-public-data.world_bank_intl_education.international_education`
WHERE
  indicator_code = "SE.XPD.TOTL.GB.ZS"
  AND year > 2000
GROUP BY
  country_name
ORDER BY
  average DESC

Command-line

bq query --use_legacy_sql=false '
SELECT
  country_name,
  AVG(value) AS average
FROM
  `bigquery-public-data.world_bank_intl_education.international_education`
WHERE
  indicator_code = "SE.XPD.TOTL.GB.ZS"
  AND year > 2000
GROUP BY
  country_name
ORDER BY
  average DESC'

Sample results are shown here:

+--------------------------------+--------------------+
|          country_name          |      average       |
+--------------------------------+--------------------+
| Vanuatu                        | 30.541126251220685 |
| Lesotho                        | 27.614941188267313 |
| Tunisia                        | 25.567561236294846 |
| Kenya                          | 24.601095744541716 |
| Ghana                          | 24.306796160611253 |
| Ethiopia                       |  24.28029394149782 |
| Botswana                       | 24.269573211669933 |
| Namibia                        |  22.96822834014892 |
| St. Vincent and the Grenadines | 22.605224609375014 |
| Djibouti                       |  22.52495741844175 |
| ...                                                 |
+--------------------------------+--------------------+

The following visualization presents an interesting comparison between countries. In the chart, the countries in gray don’t have sufficient data. You can view this visualization in Google Data Studio. For a tutorial on using Google Data Studio with BigQuery, see Visualizing BigQuery Data Using Google Data Studio.

Government education spending

About the data

Dataset Source: World Bank

Category: Encyclopedic, Economic

Use: This dataset is publicly available for anyone to use under the following terms provided by the Dataset Source - http://www.data.gov/privacy-policy#data_policy - and is provided "AS IS" without any warranty, express or implied, from Google. Google disclaims all liability for any damages, direct or indirect, resulting from the use of the dataset.

Citation: The World Bank: Education Statistics

Update Frequency: Biannual

View in BigQuery: Go to World Bank education data

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...