I hate to disappoint you, but I've never found a book that teaches SQL tricks.
I've either learned them all on my own or seen somebody use them first. Or I've seen something and then tried to improve it.
My primary resource for learning MySQL (I had previously used SQL Server and Access SQL) was just the MySQL documentation:
I actually came up with the SUM(IF(...),1,0) trick on my own maybe 12 years ago, when I was using Access (Access uses IIF instead of IF, but otherwise the same). Only to then find out a year or so later that it's a standard technique in SQL Server (where you have to use CASE WHEN instead off IIF, but concepts are the same). Anyway, when I started using MySQL heavily (starting in 2009) it was an easy transition.
MySQL has some impressively powerful features. Partitioned tables are a wonderful example. I used them to increase the performance of removing old records by a factor of maybe 100 or more. But it also has some strange limitiations. Its use of indexes, for example, is really really poor compared to SQL Server. (SQL Server will do index-only JOINs to get the number of records fetched way way down before it actually has to go get the records, per se. MySQL won't do that, at all. It's a huge limitation on performance.)