How can I do this query with Cockpit? Need help

I found this and trying to replicate into Cockpit.

What I created: author with a single name, two categories and two books. How it’s possible to list on index site the same result as the response on stackoverflow?