MariaDB Tutorial MariaDB Advanced MariaDB Database Account Management MariaDB References

MariaDB SOUNDS LIKE



The MariaDB SOUNDS LIKE statement is used to compare the soundex string of two expressions. It is used as expr1 SOUNDS LIKE expr2, which is the same as SOUNDEX(expr1) = SOUNDEX(expr2).

Syntax

expr1 SOUNDS LIKE expr2

Parameters

expr1 Required. Specify the first expression which need to be compared.
expr2 Required. Specify the second expression which need to be compared.

Return Value

Compares the soundex string of two expressions and returns the result.

Example 1:

The example below shows the usage of SOUNDS LIKE statement:

SELECT 'Here' SOUNDS LIKE 'Heir';
Result: 1

SELECT 'Principal' SOUNDS LIKE 'Principle';
Result: 1

SELECT 'Anothers' SOUNDS LIKE 'Brothers';
Result: 0

SELECT 'There' SOUNDS LIKE 'Their';
Result: 1

SELECT 'Except' SOUNDS LIKE 'Accept';
Result: 0

SELECT 'Cache' SOUNDS LIKE 'Cash';
Result: 1

Example 2:

Consider a database table called Employee with the following records:

EmpIDFirstNameLastName
1JohnSmith
2MarryKnight
3JoWilliams
4KimSmythe
5RameshGupta
6HuangZhang

To select all the records from this table where LastName sounds like 'Smythe', the following query can be used:

SELECT * FROM Employee
WHERE LastName SOUNDS LIKE 'Smythe';

This will produce the result as shown below:

EmpIDFirstNameLastName
1JohnSmith
4KimSmythe

❮ MariaDB Functions