How can I get a site's categories?

Where are a site's categories stored? I want to redirect front end traffic for sites that fall into a certain site category, however I cannot find where in the DB this value is stored.