SE has accumulated a lot of cool solutions over time, I'm sure. Of course, they aren't tagged
cool-stuff for anyone to easily find them if the person is looking for
any cool stuff. So your question may be unanswerable at the moment, unless someone has created a repository specifically for clever SQL solutions (for any problem).