By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select version();
version() |
---|
11.4.4-MariaDB-deb12 |
create table edges
(
start varchar(4),
end varchar(4)
);
insert edges(start, end) values ("a", "b");
with recursive cte (path, last) as
(
select cast("a" as char(100)), cast("a" as char(100))
union all
select CONCAT(path, "->", edges.end), edges.end from cte, edges
where cte.last = edges.start
)
select * from cte;
path | last |
---|---|
a | a |
a->b | b |