Sql postgres 9.4将多个分隔符上的列拆分为新列

Sql postgres 9.4将多个分隔符上的列拆分为新列,sql,postgresql,postgresql-9.4,Sql,Postgresql,Postgresql 9.4,关于这个问题 有没有办法根据2个分隔符将一列拆分为4列 如果我有一列包含此数据 11-3-1-4 $72390.00 我该怎么做 col1 col2 col3 col4 col5 11 3 1 4 72390.00 另外,我应该保留原始列吗?字符串到数组()可用于: select c1[1] as col1, c1[2] as col2, c1[3] as col3, c1[

关于这个问题

有没有办法根据2个分隔符将一列拆分为4列

如果我有一列包含此数据

11-3-1-4 $72390.00
我该怎么做

col1    col2    col3    col4    col5
11      3       1       4       72390.00
另外,我应该保留原始列吗?

字符串到数组()可用于:

select c1[1] as col1, 
       c1[2] as col2, 
       c1[3] as col3,
       c1[4] as col4,
       substr(col5, 2) as col5
from (
   select string_to_array((string_to_array(the_column, ' '))[1], '-') as c1,
          (string_to_array(the_column, ' '))[2] as col5
   from the_table
) t