If you want to be able to run SQL queries against the SQLTag tables, you have to use the Database Driving Provider for your tags. You cannot connect to the Internal SQLTags Provider.
Would it be difficult to implement a new scripting function that would return a list of tags from the gateway into a dataset? I imagine the dataset would look like a subset of columns from the csv export file. I store a lot of lists in the database that I use on screens (in dropdown lists, for example) to drive indirect bindings on components. It would be nice if simply adding a folder to the tag hierarchy would allow a script on the screen to dynamically update the dropdown list.