backendgym backendgym · reps Sign in with GitHubSign in

03Judge a view that miscounts

sql-viewing / reps/03/README.md

An assistant wrote the view in answer.sql, which counts collections per artist. Read it first, then run it and compare with the expected result below. Fix the view inside the transaction.

Expected once fixed: Chen Wei has 1 active collection. The shipped view says 2, and still returns 3 rows.

After the rep
  1. 1 Which condition was missing from the shipped view? Would reading current_collections instead have been a better fix, and why?