Cohorts & audiences are commonly used to enrol users in courses, via the cohort/audience sync enrolment method. To identify the Cohorts/Audiences that have been used to enrol learners in course you can use the following query to create a derived table. 


SELECT c.id as cohortid, cm.userid as userid, e.courseid as courseid, c.name as cohort
FROM mdl_cohort c
INNER JOIN mdl_cohort_members cm ON (cm.cohortid = c.id)
INNER JOIN mdl_enrol e ON (e.customint1 = c.id)


This derived table should be joined to the mdl_course and mdl_user tables to pull in the actual course/user information. This can be done with an INNER JOIN (see below) to only show courses that have users enrolled via cohorts or audiences.