Nested Query
Nested Query
Theory-
Tables
Employees
Awards
id employee_id award_date
1 1 2022-04-01
2 3 2022-05-01
1. In operator-The IN operator checks if a column value in the outer query's
result is present in the inner query's result. The final result will have rows
that satisfy the IN condition.
Syntax-
Output-
id name
1 Augustine Hammond
3 Cassy Delafoy
Output-
id name
2 Perice Mundford
4 Garwood Saffen
5 Faydra Beaves
3. All operator-The ALL operator compares a value of the outer query's result
with all the values of the inner query's result and returns the row if it
matches all the values.
Syntax-
Output-
4. Any operator -The ANY operator compares a value of the outer query's
result with all the inner query's result values and returns the row if there is a
match with any value.
Syntax-
Output-
Table books
Suppose, we want to fetch the first name and the last name of those students who have issued at least
one book.
Output:
First_name Last_name
Ishika Goel
mahi jain