To solve the given query, we need to understand the SQL MINUS operator, which returns distinct rows from the first SELECT statement that aren't present in the results of the second SELECT statement.
Consider the data from both tables:
emp1
Id
Name
1
Amit
2
Punita
emp2
Id
Name
1
Punita
2
Anand
Now, let's break down the SQL query:
SELECT name from emp1 will produce:
Amit
Punita
SELECT name from emp2 will produce:
Punita
Anand
Applying the MINUS operator:
Remove the names that appear in both lists.
Punita is common in both, so it is removed.
This leaves:
Amit
Thus, the output of the query SELECT name from emp1 minus SELECT name from emp2; is:
Amit
Was this answer helpful?
0
0
Show Solution
Verified By Collegedunia
Approach Solution -2
The output of the SQL query SELECT name FROM emp1 MINUS SELECT name FROM emp2 is amit.
Additional Context:
MINUS Operation:
Returns distinct rows from first query not present in second