293 views
0 votes
0 votes

What is the answer of below query and please give detailed answer how exists work as i think it only check row in inner query exist or not?

1 Answer

Best answer
2 votes
2 votes
0,3 and 1 are the number of tuples for Q1, Q2 and Q3 repsectively.

First, the outer query executes and then for each tuple of the output of the outer query, Inner query executes, if the inner query results in atleast one tuple, then EXISTS returns TRUE, if exists returns TRUE, then corresponding tuple of the outer query's ouptut is printed or listed.

And NOT EXISTS is opposite of TRUE.

Please correct me if i am wrong.
selected by

Related questions

0 votes
0 votes
1 answer
3
rayhanrjt asked Jan 6, 2023
771 views
Write SQL command to find DepartmentID, EmployeeName from Employee table whose average salary is above 20000.
2 votes
2 votes
1 answer
4
Subhrangsu asked Jun 18, 2022
447 views
Write SQL query to show all employees hired on June 4,1984 (non-default format)emp(empno,ename,job,mgr,hiredate,sal,comm,deptno)