
SQL. Professor: ID, NAME, DEPARTMENT_ID, SALARY. Department: ID,NAME. Course: ID, NAME, DEPARTMENT_ID, CREDITS. Schedule:PROFESSOR_ID, COURSE_ID, SEMESTER, YEAR.
A university maintains data on professors, departments, courses, and schedules in four tables: DEPARTMENT, PROFESSOR, COURSE, and SCHEDULE. The university's new Dean is streamlining their scheduling and wants to know which changes would be necessary to ensure that each professor only teaches courses within their own department. Write a query to print the names of professors with the names of the courses they teach (or have taught) outside of their department. Each row in the results must be distinct (i.e., a professor teaching the same course over multiple semesters should only appear once), but the results can be in any order.