PostgreSQL - Common Table Expressions
Given the table
What will be the output of this query?
edges(source INT, target INT) with data:(1, 2), (2, 3), (3, 4)What will be the output of this query?
WITH RECURSIVE path AS ( SELECT source, target FROM edges WHERE source = 1 UNION ALL SELECT e.source, e.target FROM edges e JOIN path p ON e.source = p.target ) SELECT * FROM path ORDER BY source, target;
