cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

How to search an array of words in a text field

183530
New Contributor III

Example:

TABLE 1

FIELD_TEXT

I like salty food and Italian food

I have Italian food

bread, rice and beans

mexican foods

coke, sprite

array

['italia', 'mex','coke']

match TABLE1 X ARRAY

Results:

I like salty food and Italian food

I have Italian food

mexican foods

is it possible to do in sql or pyspark?

1 REPLY 1

User16756723392
New Contributor III

A simple way

select FIELD_TEXT from TABLE 1 where FIELD_TEXT like 'italia' OR FIELD_TEXT like 'mex' OR FIELD_TEXT like 'coke'

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.