QuestionQ74

Executing queries using Databricks SQL and Databricks SQL Warehouses

A data analyst is working with a nested products array column in the transactions table. The analyst needs to return the first array item for each row.

The data analyst is using this incomplete command:

Question Image

Which line of code should the data analyst use to fill the blank in the preceding code block so that the task completes successfully?

  • A products.1
  • B products.0
  • C products[0]
  • D products[1]
Explanation

In GoogleSQL for BigQuery, array indexes are zero-based. Using products[0] accesses the element at offset 0, which is the first item in each products array.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!