The best way to learn something is to try it yourself. So, we've turned a bunch of the demos our instructors do into Do-It-Now activities, where students can try each concept out in quick, bite-size activities.
If you are using these as part of an Instructor Led Training (ILT), make sure to listen to your instructor and coordinate your efforts with their direction.
1M
to 10M
. Rerun the query and note the job info.100M
, 1B
, 10B
and 100B
tables.bigquery-samples
project by namebigquery-public-data
project by nameroi-bq-demos
project by nameclass
query with subquery
query into the BigQuery editorwith clause
query in BigQueryWhat if you like that subquery a lot, and would like to use it in many other queries? Rather than copy/paste over and over, you can create a view. A view is just a saved, shared subquery.
create view
query in BigQueryquery view
query, which queries the viewselect * from `roi-bq-demos.bq_demo.customer` where cust_state = "AK"
roi-bq-demos.bq_demo.orders
)-- view up-to-date table
query. This should show you the total number of orders per month, with values for Jan. and Feb.-- view table with only initial load
query from the SQL file in Github and paste it into your BigQuery editor.target
with the time travel target value that was output in your Cloud Shell window. It should look like this: 1654541783-- create restoration table
query from the SQL file in Github and paste it into your BigQuery editor.target
with the time travel target value that was output in your Cloud Shell window. It should look like this: 1654541783bigquery-public-data.noaa_gsod
pinned.stn 038110
in 1929
03110
entries for 1929
, 1930
, 1931
?038110
entries for 1929-1939
using a wildcard table038110
entries in ALL the tables in the dataset?jwd-gcp-demos/orders_partitioned/*
gs://jwd-gcp-demos/orders_partitioned/
ext_part
query the external table
queryquery external table with where clause
query;query external table on partition
query; trim strings
query. What does it do? How does it do it?create udf
queryquery with SQL UDF
querycreate javascript udf
queryquery with javascript udf
querypopulate arrays explicitly
query, and review the resultspopulate arrays using array_agg
query, and review the resultsreport array length
query, and review the results. find by array length
query from the git file).select basic array from array
query. Review the results.select table from array
query. Review the results.Unnest
flattens the array into a table.calculate average of array
query. basic correlated cross join
query. The CTE at the top is just creating an initial arrays
table with two rows and two columns. Review the standard results output and the JSON output.comma correlated cross join
query.UNNEST
, it's done for you implicitly. Review and run the comma implicit unnest
query.-- find row where num_array contains 2 - take 1
query. Review the results.-- find row where num_array contains 2 - take 2
query. -- find row where num_array contains 2 - take 3
query. All three of these queries return the same results, but there are differences in performance on large datasets. Let's explore that.
find commits that...
queries, noting the time taken for each to run.find sales/zip for march from nested_once table
query (replace
with the instructor's project ID)find sales/zip for march from nested/partitioned table
query (replace
with the instructor's project name)find sales for 6 months in 8754 from nested
query (replace
with the instructor's project name). Note the duration and data processed.find for 6 months in 8754 from nested/partitioned query
(replace
with the instructor's project name) and note the duration and data processed.find for 6 months in 8754 from nested/partitioned/clustered
query (replace
with the instructor's project name) and note the duration and data processed.class
dataset.-- query against original tables...
query. -- query against original tables...
query.-- First query - exact query
in one editor tab. This query will find the number of unique article titles in the 106B row wikipedia table-- Second query - approx
query. This will approximate the number of unique article titles in the 106B row wikipedia table.