更新时间:2022-12-11 19:06:23
有很多方法可以做到这一点. 一种方法是使用 string_to_array 函数:
There is many ways to do this. One way is using the string_to_array function:
INSERT INTO hobbies (id, hobby1, hobby2, hobby3)
SELECT id,hobbies_array[1],hobbies_array[2],hobbies_array[3] FROM
(
SELECT id,string_to_array(hobbies,',') AS hobbies_array
FROM inf
) AS foo;