00:01
Hello student, here to print the name of the processor with the name of the course they teach or have taught outside of their department.
00:08
You can use sql queries that involve joining the professor course and department table while filtering for course taught outside the professor department.
00:17
Here is the query that accomplished this.
00:19
Select distinct p .name as professor name c .name as course name from professor p.
00:30
Now join the course .c on p .id equal to c .professor id.
00:38
Now left join the department d on p .department id equal to d .id where c .department id is null or c .department id is not equal to p .department id.
00:57
So this is the query.
00:58
Here is the explanation.
00:59
First we select the distinct pair of the professor name and the course name.
01:03
So here select distinct p .name and c .name.
01:08
So here we have selected professor and the course name.
01:11
We join the professor table aliased as p.
01:15
So professor table is known as now aliased so its name is now p.
01:22
With the course table which is aliased as c...