To address the query, understanding the SQL MINUS operator is essential. This operator yields distinct rows from the first SELECT statement that are not found in the results of the second SELECT statement.
Examine the data from both tables:
emp1
Id
Name
1
Amit
2
Punita
emp2
Id
Name
1
Punita
2
Anand
Let's analyze the SQL query components:
The result of SELECT name from emp1 is:
Amit
Punita
The result of SELECT name from emp2 is:
Punita
Anand
Applying the MINUS operator involves:
Eliminating names present in both lists.
The name 'Punita' is common and is therefore removed.
The remaining name is:
Amit
Consequently, the output for the query SELECT name from emp1 minus SELECT name from emp2; is: