How do you create log reports with MySQL?

I’m trying to debug my automations, and am trying to get information from the database, such as when an entity changes state and an automation is triggered during a specified period. I find the history and log functions in HA to be slow and not very helpful. What I want is the output in a table format, preferably from a sql statement. I’m sure I’m not the only one who wants to get information in a table format instead of a GUI report.

Have people created anything that helps extract this information from the database? Even something that you just run in phpmyadmin?