Snowflake Vs MS-SQL - Part 42 - Search Data
Search Data
A table contains multiple columns and if you want to search a particular word in any one of these columns.
Suppose you have data as below:
+---------------------------+-----------------+
| PLAY | CHARACTER |
|---------------------------+-----------------|
| All Well That Ends Well | KING |
| Henry IV Part 1 | KING CLAUDIUS |
| John John | CHATILLON |
| King John | KING JOHN |
| Lear Lear | GLOUCESTER |
+---------------------------+-----------------+
Expected Output
+---------------------------+-----------------+
| PLAY | CHARACTER |
|---------------------------+-----------------|
| All Well That Ends Well | KING |
| Henry IV Part 1 | KING CLAUDIUS |
| King John | KING JOHN |
+---------------------------+-----------------+
MS-SQL Server
You can achieve this by using the LIKE & Wild Card as follows.
In Snowflake, we can use the same approach as above however Snowflake has a different operation SEARCH.
Comments
Post a Comment