Appearance
NYSIIS
Return the phonetic representation of a string by applying the New York State Identification and Intelligence System (NYSIIS) algorithm.
NYSIIS(string)
This function returns a VARCHAR(6)
data type.
For example, find names in a table that match the phonetic representation of some constants:
premdb=# select * from player
where nysiis(firstname)=nysiis('Moe') or nysiis(firstname)=nysiis('Alex');
playerid | teamid | seasonid | firstname | lastname | position | dob | weekly_wages | avg_mins_per_match | matches_played | cob
----------+--------+----------+-----------+----------+----------+------------+--------------+--------------------+----------------+-------
6 | 25 | 27 | Alexis | Sanchez | F | 1988-12-19 | 410000 | 71.2309 | 31.5 | Chile
13 | 23 | 27 | Mo | Salah | F | 1992-06-15 | 200000 | 82.2765 | 36.2 | Egypt
(2 rows)
Find rows in the team
table where the phonetic representations of values in three different columns all match:
premdb=# select * from team where nysiis(name)=nysiis(city) and nysiis(city)=nysiis(stadium);
teamid | htid | atid | name | nickname | city | stadium | capacity | avg_att
--------+------+------+--------------+----------+---------+----------------------+----------+---------
11 | 12 | 61 | Cardiff City | Clarets | Cardiff | Cardiff City Stadium | 33280 | 0.000
(1 row)