Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Project Task Dependency Resolution | Recursive CTEs and Hierarchical Data
Mastering Common Table Expressions (CTEs) in SQL
Sektion 2. Kapitel 5
single

single

bookChallenge: Project Task Dependency Resolution

Stryg for at vise menuen

Opgave

Swipe to start coding

Write a recursive CTE that retrieves all tasks (direct and indirect) that must be completed before a specified project task can begin. Use the sample data provided, which contains task dependencies for multiple projects. Your query should return the task IDs and names of all prerequisite tasks for the given task_id.

  • Start the recursion from the immediate dependencies of the specified task_id.
  • In each recursive step, find dependencies of the tasks found in the previous step.
  • Continue until all transitive dependencies are found.
  • Return each prerequisite task's ID and name.
  • The output should include only the prerequisite tasks, not the specified task_id itself.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 2. Kapitel 5
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

some-alt