Hard SQL interview questions combine two or three patterns: rank within groups and keep ties, find streaks, compute retention, or reset a running total at a boundary. Interviewers care as much about how you handle the edge cases as about the final query, so say them out loud: ties, NULLs, empty periods, whole-number division.
Build each answer in CTE steps and check each one. All questions are written for this site and use Kestrel's tables.