December 2017
Beginner to intermediate
264 pages
5h 38m
English
Wildcard is a way of performing a union on tables whose names are similar and have compatible schemas. The following queries show how to perform wildcard operations on tables in the public dataset bigquery-public-data:new_york provided by Google.
The following query gets the number of trips per year made by a yellow taxi in New York. The query uses UNION ALL on all tables that start with the name tlc_yellow_trips_. If a new table is added for 2017, this query has to be modified to include that table as well. To automatically include tables having similar names in the query, wildcard table syntax can be used. This query uses standard SQL:
#standardSQLSELECT MAX(EXTRACT(YEAR from pickup_datetime)) as TripYear, count(1) as TripCount ...