PostgreSQL
 sql >> Base de Dados >  >> RDS >> PostgreSQL

Vários dividir e atribuir order_id


Use translate() :
SELECT "ID", token, row_number() over (partition by "ID")
FROM (
    SELECT "ID", s.token
    FROM   
        Table1 t, 
        unnest(string_to_array(translate(t.address, '.,:;-', '     '), ' ')) 
            s(token)
    WHERE token <> ''
    ) sub

SqlFiddle .