How would you correct the error?

Topic 5, Practice Questions

Suppose you have a table that includes a nested column called "city" inside a column called "person", but when you try to submit the following query in BigQuery, it gives you an error. SELECT person FROM `project1.example.table1` WHERE city = "London"

How would you correct the error?
A . Add ", UNNEST(person)" before the WHERE clause.
B . Change "person" to "person.city".
C . Change "person" to "city.person".
D . Add ", UNNEST(city)" before the WHERE clause.

Answer: A

Explanation:

To access the person.city column, you need to "UNNEST(person)" and JOIN it to table1 using a comma.

Reference: https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#nested_repeated_results

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments