2017-08-30 19 views
0

私はステートメントである私のテーブルに人と呼ばれる列を持っています。私はその列から名前だけを抽出する必要があります。postgresqlのステートメントから最初の要素を抽出します

人:

Ramu is a good dancer. 
Raj is the highest scorer in maths. 

私は、これらのステートメントからの名前のみ(のRamu、ラジ)を抽出する必要があります。 ヒント:isの前にある名前は、すべてisとなっています。

私が使用split_part(): PostgreSQLの

答えて

0

を抽出していないか

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) 
関連する問題