Update SQL queries for teacher/* to reflect new database structure.