I’m currently in the process of writing ASP.Net controls that look in the WordPress database and render out it’s data in a knowledge base like format. I’m probably be sharing some of the SQL (as well as the controls later) I’m using to read the info.
Here’s the code to view the unique categories that exist in your WordPress tables.
select distinct t.term_id, name, count
from wp_term_taxonomy tt
inner join wp_terms t on tt.term_id = t.term_id
where taxonomy = 'category'