目录

PgSQLpostgresql-大象数据库拆分截取字符串列转行

目录

PgSQL(postgresql) 大象数据库拆分截取字符串(列转行)

PgSQL(postgresql) 大象数据库 拆分字符串/字段( 列转行)

需求:由表  Test_1,转换得出 表 Test_2

(1)Test_1 表:

https://i-blog.csdnimg.cn/blog_migrate/21eb723e27133eae6344890b62c8db9e.png

(2)Test_2 表:

https://i-blog.csdnimg.cn/blog_migrate/d4d19e641c8ddb1fc45f2d9114416e9f.png

SQL如下:

select

id

, regexp_split_to_table(name,’,')

from Test_1

;