SQL for making teaching assignments