I need to run an SQL query and get a program_id and department_id of a specific course for each student. I am thinking of running an IF condition to check if the course name is in program and get it's ID but I don't know yet where to use the IF condition in the query.
sample code:
for row in cur_t:
course = row['course']
cur_p.execute("""SELECT id from program where name='$[course]']
WHERE department_id=?? """)
Problem is I have 3 department IDs ( Senior High, Vocational, Undergraduate ) and each ID have multiple programs/courses. Each program/course is connected to the deparment table via department_id.