Exam4Training

How would you query specific partitions in a BigQuery table?

How would you query specific partitions in a BigQuery table?
A . Use the DAY column in the WHERE clause
B . Use the EXTRACT(DAY) clause
C . Use the __PARTITIONTIME pseudo-column in the WHERE clause
D . Use DATE BETWEEN in the WHERE clause

Answer: C

Explanation:

Partitioned tables include a pseudo column named _PARTITIONTIME that contains a date-based timestamp for data loaded into the table. To limit a query to particular partitions (such as Jan 1st and 2nd of 2017), use a clause similar to this:

WHERE _PARTITIONTIME BETWEEN TIMESTAMP (‘2017-01-01’) AND TIMESTAMP (‘2017-01-02’)

Reference: https://cloud.google.com/bigquery/docs/partitioned-tables#the_partitiontime_pseudo_column

Exit mobile version