SOUNDS LIKE (Lakehouse v1)
Compares the pronunciation of two strings by their Soundex codes. Soundex is a phonetic algorithm that produces a code representing the pronunciation of a string, allowing for approximate matching of strings based on their pronunciation rather than their spelling. PlaidCloud Lakehouse offers the SOUNDEX function that allows you to get the Soundex code from a string.
SOUNDS LIKE is frequently employed in the WHERE clause of SQL queries to narrow down rows using fuzzy string matching, such as for names and addresses, see Filtering Rows in Examples.
Analyze Syntax
Section titled “Analyze Syntax”func.sounds_like(<str1>, <str2>)Analyze Examples
Section titled “Analyze Examples”func..sounds_like('Monday', 'Sunday')┌───────────────────────────────────────┐│ func..sounds_like('Monday', 'Sunday') │├───────────────────────────────────────┤│ 0 │└───────────────────────────────────────┘SQL Syntax
Section titled “SQL Syntax”<str1> SOUNDS LIKE <str2>Arguments
Section titled “Arguments”| Arguments | Description |
|---|---|
| str1, 2 | The strings you compare. |
Return Type
Section titled “Return Type”Return a Boolean value of 1 if the Soundex codes for the two strings are the same (which means they sound alike) and 0 otherwise.
SQL Examples
Section titled “SQL Examples”Comparing Strings
Section titled “Comparing Strings”SELECT 'two' SOUNDS LIKE 'too'----1
SELECT CONCAT('A', 'B') SOUNDS LIKE 'AB';----1
SELECT 'Monday' SOUNDS LIKE 'Sunday';----0Filtering Rows
Section titled “Filtering Rows”SELECT * FROM employees;
id|first_name|last_name|age|--+----------+---------+---+ 0|John |Smith | 35| 0|Mark |Smythe | 28| 0|Johann |Schmidt | 51| 0|Eric |Doe | 30| 0|Sue |Johnson | 45|
SELECT * FROM employeesWHERE first_name SOUNDS LIKE 'John';
id|first_name|last_name|age|--+----------+---------+---+ 0|John |Smith | 35| 0|Johann |Schmidt | 51|