How to create a new column through a old one with REGEX in BigQuery?

后端 未结 1 1920
暖寄归人
暖寄归人 2021-01-28 23:56

I would like to create a new column through an old one.

I have this column: name. It\'s a String column. I have this kind of data:

         


        
1条回答
  •  南方客
    南方客 (楼主)
    2021-01-29 00:38

    In Standard SQL, we can try using the SPLIT() function:

    SELECT
        SPLIT(input, '_')[OFFSET(0)] part1,
        SPLIT(input, '_')[OFFSET(1)] part2,
        SPLIT(input, '_')[OFFSET(2)] part3,
        SPLIT(input, '_')[OFFSET(3)] part4,
        SPLIT(input, '_')[OFFSET(4)] part5
    FROM (SELECT "ALUMNNAME_SURNAME_CLASS_UNIVERSITY_YEAR_(16/09 - 22/09)" input)
    

    0 讨论(0)
提交回复
热议问题