Home > database >  How to split column by delimiter on Google BigQuery
How to split column by delimiter on Google BigQuery

Time:10-28

I've a column of emails and I'd like to split it into two columns using @ as a delimiter.

Table:

enter image description here

Expected outcome

enter image description here

CodePudding user response:

Try

select split(email, "@")[ofsset(0)],split(email, "@")[ofsset(1)] 

CodePudding user response:

Try SPLIT with subsequent OFFSET:

SELECT SPLIT(email, '@')[OFFSET(0)] as email1, SPLIT(email, '@')[OFFSET(1)] as email2
FROM mytable
  • Related