Learning how to create plugins. I want to do a select query in an existing table in the Craft database, build navigation HTML and then return that HTML using a variable. I can see how to set up my own variable using the *Variable.php file. In the docs I don't see how querying database tables is done with any of the sections of the plugin found here.
I am guessing that I would use a class in the Craft classes?
If so then...
Do I put my logic for querying the table in my method to return the variable value, in my primary plugin class or somewhere else?
Which classes would I use?