Categorize Juan's dogs with GROUP BY
Find duplicate emails with HAVING
A simple LEFT JOIN
A subquery might be easier to read than a JOIN
Get the time between thunderstorms with LAG()