How to get Cohort name from db in openedx turor

I need to get Cohort user details from database. I know the table to fetch that but I have only Cohort name like Cohort 2 , Cohort 3. I need to fetch the cohort_id by name. How can I get that from db.