Home > database >  Postgresql - splitting numbers and letters in a column
Postgresql - splitting numbers and letters in a column

Time:09-05

I'm trying to split the following column in numbers and letters. Can someone please advise on how this can be achieved?

Duration
--------
90 Min

CodePudding user response:

We can use SUBSTRING here:

SELECT SUBSTRING(duration FROM '^\d ') AS num,
       SUBSTRING(duration FROM '^\d  (.*)') AS letter
FROM yourTable;
  • Related