clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2335898 fiddles created (27461 in the last week).

create table source ( linenr integer unique not null, key text not null, value text ); insert into source values ( 2, 'tags', 'a' ), ( 3, '...', 'b' ), ( 4, 'title', 'The Title' ), ( 5, 'note', 'this is' ), ( 6, '...', 'an EXAMPLE' ), ( 8, 'title', 'over' ), ( 9, '...', 'three' ), ( 10, '...', 'lines' ), ( 11, 'about', 'grouping' );
9 rows affected
 hidden batch(es)


select linenr, key, value, case when key <> '...' then 1 end as rst from source;
linenr key value rst
2 tags a 1
3 ... b
4 title The Title 1
5 note this is 1
6 ... an EXAMPLE
8 title over 1
9 ... three
10 ... lines
11 about grouping 1
 hidden batch(es)


select linenr, key, value, sum(rst) over (order by linenr) grp from ( select linenr, key, value, case when key <> '...' then 1 end as rst from source ) x;
linenr key value grp
2 tags a 1
3 ... b 1
4 title The Title 2
5 note this is 3
6 ... an EXAMPLE 3
8 title over 4
9 ... three 4
10 ... lines 4
11 about grouping 5
 hidden batch(es)