QuestionQ125

VerifiedExecuting queries using Databricks SQL and Databricks SQL Warehouses

A data analyst filters rows whose tags array contains the value sql with this query:

SELECT * FROM main.analytics.articles WHERE tags = ‘sql’;  

The query returns no results.

How should the analyst query rows where the tags array contains sql?

Explanation

Databricks SQL uses array_contains(array, value) to return TRUE when an array includes a specified element, so the filter should use array_contains(tags, 'sql'). The function name in the selected choice has a typographical error; the valid function name is array_contains.

Learn more

Community Discussion

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