
Answer-first summary for fast verification
Answer: Change 'person' to 'person.city'.
To correctly access the nested 'city' column within the 'person' column, you should modify the query to reference 'person.city'. This approach directly accesses the nested field without requiring an UNNEST operation for this specific query. For more complex scenarios involving arrays or repeated fields, UNNEST might be necessary. Reference: [BigQuery Documentation](https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#nested_repeated_results).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are working with a table in BigQuery that contains a nested column named 'city' within a column named 'person'. However, when you attempt to run the query SELECT person FROM 'project1.example.table1' WHERE city = 'London', an error occurs. What is the correct way to fix this error?
A
Change 'person' to 'city.person'.
B
Add ', UNNEST(city)' before the WHERE clause.
C
Add ', UNNEST(person)' before the WHERE clause.
D
Change 'person' to 'person.city'.
No comments yet.