Explain a time you used SQL to solve a complex data problem. What was the problem and how did you approach it?