Subqueries with IN and NOT IN

Explain with examples for the Subqueries with IN and NOT IN.

Sub Query Example with IN: Displays employees from employee table with bonus > 1000. Using IN first all employees are selected and compared to each row of the subquery. Select first_name from employee
Where bonus_id IN (select id from bonus Where bonus_amt > 1000);

Sub Query Example with NOT IN: Displays employees from employee table with bonus < 1000. Using NOT IN first all employees are selected and compared to each row of the subquery.
Select first_name from employee Where bonus_id NOT IN (select id from bonus Where bonus_amt < 1000);
Subqueries with comparison operators
Comparison operators can be used (like <, >, =, !> etc). Sub queries used with comparison........
Subqueries with Exists and NOT Exists
A subquery with Exist does not really return any data; it returns TRUE or FALSE........
Insert Statement with an example
INSERT: The Insert statement is used to insert values as rows in a table........
Post your comment