Erzhuo Wang's SQL code