Exercise 1: Tracing the Reorganization — Possible Solution ==================================================================== WHAT movePage() UPDATES DIRECTLY ------------------------------ Per this chapter and Chapter 10, movePage() looks up the page being moved, computes its new full_path via computeFullPath(), and updates that single row's own parent_id and full_path columns directly with one UPDATE query. HOW EVERYTHING BENEATH IT IS HANDLED ------------------------------ Per this chapter and Chapters 6 and 10, a single recursive CTE query then finds every descendant of the moved page, at any depth, in one call - not one query per level. The result set is ordered by depth ascending, so a plain linear for loop (not a recursive function) can walk it top to bottom: each descendant's new full_path is built from its own parent's already-computed new path (available in the same loop, since parents are always processed before their children in this ordering), then written with its own UPDATE query. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly separates the two distinct steps - the direct update of the moved page, and the recursive-CTE-plus-linear-pass handling of its descendants - and correctly explains why the depth-ordered result set makes a single linear loop sufficient instead of a recursive walk.