So you want to choose id = 16, because this is the only one that constantly increments values.
Many versions of SQL lag() support can help solve this problem. You can determine for a given identifier if all values โโincrease or decrease by doing:
select id, (case when min(score - prev_score) < 0 then 'nonincreasing' else 'increasoing' end) as grp from (select t.*, lag(score) over (partition by id order by year) as prev_score from table t ) t group by id;
Then you can select all the "increasing" identifiers using the connection:
select t.* from table t join (select id from (select t.*, lag(score) over (partition by id order by year) as prev_score from table t ) t group by id having min(score - prev_score) > 0 ) inc on t.id = inc.id;
source share