Data Bench
Challenge on lesson: Checkpoint: Data Layer
CHALLENGE
Difficulty: intermediate+25 XP
Write THREE functions. 1) joinPlan(query) โ given a desired query description, return the join type: "users and their tasks (skip users with none)" => "inner"; "all users with task counts (zero included)" => "left"; "all tasks with their tag names" (many-to-many) => "inner-two" (two joins); anything else => "none". 2) txDecision(steps, hasFailureRisk) โ return "transaction" when there are 2+ write steps OR hasFailureRisk; "single" when exactly one write step and no risk; "readonly" when zero write steps. 3) countQueries(taskCount, pattern) โ pattern "n+1" => taskCount + 1 queries; "join" => 1; "in-clause" => 2.
Press Submit to check your solution.
Back to lesson: Checkpoint: Data Layer