Assignment 3 Complex queries v3 Solution