A query: find the chairs of all departments that offer no courses", requires implementation of the ANTIJOIN operation. The ANTIJOIN operation returns all rows from the first argument of the operation, that cannot be joined with any row from the second argument of the operation.
In contrast, the JOIN operation returns all rows joined from the first and the second argument of the operation. In the other words, all rows from the first and the second argument that can be joined.
The SEMIJOIN operation is the opposite to the ANTIJOIN operation and it returnes all rows from the first argument of the operation, that can be joined with at least one row from the second argument of the operation.
Both ANTIJOIN and SEMIJOIN operations are not directly implemented in SQL.
The SEMIJOIN operation can be expressed in two different ways. The first one, is a simple JOIN operation and later on projection on the attributes of the first argumentof JOIN operation. The second method uses a nested query with: IN condition, in WHERE clause of an outer SELECT statement.
The ANTIJOIN operation can be expressed through: LEFT or RIGHT OUTER JOIN operation, and: IS NULL condition, over the columns from either right or left argument of the operation. The ANTIJOIN operation can also be implemented as a nested query with: NOT IN condition, in outer SELECT statement.
A query: "find the chairs of all departments that offer no courses" is equivalent to a query, that finds all rows in a relational table: DEPARTMENT, that cannot be joined with any row in a relational table: COURSE. It is why we have to implement it, as the ANTIJOIN operation. An inner query implemented as an inline view: Q, finds all departments, that offer at least one course. Implementation of an inline view: Q, is given in the middle of the present slide. An outer query, finds all chairs of departments, that are NOT included in the results of an inner query. A temporary implementation of an outer query is given at the bottom of the present slide. Note, that a reference to an inline view: "name not in Q dot offered by", is not syntactically correct and it is included only to show a location where an an inline view: Q, must be embedded into the final implementation.