By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t as
select 1 as id, 'This is nice pen looking good' as title union all
select 2 as id, 'This is nice pen looking elegent' as title union all
select 3 as id, 'This is nice pen looking great' as title union all
select 4 as id, 'This is nice pen looking best.' as title
Records: 4 Duplicates: 0 Warnings: 0
Select t.*,
substring_index(substring_index(concat(' ', title, ' '), ' looking ', -1), ' ', 1) as next_word
from t
where title LIKE '%looking%'
id | title | next_word |
---|---|---|
1 | This is nice pen looking good | good |
2 | This is nice pen looking elegent | elegent |
3 | This is nice pen looking great | great |
4 | This is nice pen looking best. | best. |