I have tables Teachers(tid int, teacherName varchar(20)) and Lectures(lid int, tid int, lectureName varchar(20)). This is a simplified version of my tables.
A scalar function f(tid int) returns the number of lectures for a teacher. I want to call this function for each teacher in Teachers.
Is it possible to implement this without a cursor (in which I place all the teachers and then call the function for each row)?