Querying public data

Analysts can begin by querying public data provided by Google. These datasets span a wide variety of subjects, such as the NYC Tree Census, Stack Overflow Question Data, and Chicago Crime Data. More information can be found at: https://cloud.google.com/bigquery/public-data/.

To navigate to the dataset, choose the Display Project option by opening the menu as shown here in the BigQuery web console screen:

Type the name of the project, as shown in this screenshot:

Let's start by querying the US census dataset:

  1. Click on the dropdown titled bigquery-public-data; then click on the dropdown titled population_by_zip_2010.
  2. You should see a section titled Table Details with schema information for the table. You can also click on the Details button to see details such as table size, row count, and the last modified datetime.
  3. Click on the Preview button to see the first few rows of the table. This allows you to get a quick view of the data prior to running a query.
  1. Enter the following query in the BigQuery web interface query dialog and click on the Show Options button. Under the last option on the list, make sure you uncheck use legacy SQL. Click on Run Query:
#standardSQL
SELECT zipcode, population
FROM `bigquery-public-data.census_bureau_usa.population_by_zip_2010`
ORDER BY population DESC

The query will result in a list of the most populated ZIP codes in the US:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.9.148