Creating custom badge with custom rules

hey, this is really helpful.
I have enabled the SQL queries option, just stuck with a small thing after that I am good to go.

How to view the database because my custom badge rule is complex so that is why I need few things -

  1. How to view the database, so that I can build my own query
  2. How to test these badges after building queries.

Kindly answer these 2 things after that I can peacefully sleep.