I can express my ideas well enough in various Datalog/Prolog variants w/ the horn syntax. But when it comes to translating that from several discrete simple propositions into one massive CTE-stack SQL query I get very puzzled. I wrote a toy Datalog-to-SQLite compiler (https://percival.jake.tl) but I struggle to grasp the translation skill myself