从postgresql中的语句中提取第一个元素
extracting first element from a statement in postgresql
我的 table 中有一个名为 people 的专栏,它是一个声明。我只需要从该列中提取名称。
人:
Ramu is a good dancer.
Raj is the highest scorer in maths.
我只需要从这些语句中提取名称 (ramu,raj)。
提示:is
之前的名称,因为所有语句在这里都有一个词 is
。
我不知道如何在 postgresql 中提取
with people(statement) as (
values
('Ramu is a good dancer.'),
('Raj is the highest scorer in maths.')
)
select split_part(statement, ' ', 1) as name
from people;
name
------
Ramu
Raj
(2 rows)
我的 table 中有一个名为 people 的专栏,它是一个声明。我只需要从该列中提取名称。
人:
Ramu is a good dancer.
Raj is the highest scorer in maths.
我只需要从这些语句中提取名称 (ramu,raj)。
提示:is
之前的名称,因为所有语句在这里都有一个词 is
。
我不知道如何在 postgresql 中提取
with people(statement) as (
values
('Ramu is a good dancer.'),
('Raj is the highest scorer in maths.')
)
select split_part(statement, ' ', 1) as name
from people;
name
------
Ramu
Raj
(2 rows)