db.l3.ai

Play

lessons

what-changed-in-19

editor

engine: not started

results

Run a query to see rows here.

check

Cycle guard

Bad data can contain a loop, and a recursive query would never end. The CYCLE clause marks a row that repeats a value and stops following it.

task

tmp_emp(emp_id, manager_id) holds a loop 1 to 3 to 2 to 1. Count the rows reachable from employee 1 without looping forever, using CYCLE.

hints