How to get Categories by user?

What would be the SQL query to get the Categories for a given site?

The reason, I would like to use Categories a user has selected to focus ad placement on respective sites. For example, if a user selects the categories Motorcycles, Cooking, and Photography, then I can show related ads on their site.

I've been looking through the database and I cannot for the life of me find where each site's selected categories are stored.

Thanks