Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What are Anti joins



What are Anti joins..

Answer / vivek

Anti-joins:
Anti-joins are written using the NOT EXISTS or NOT IN
constructs. An anti-join between two tables returns rows
from the first table for which there are no corresponding
rows in the second table. In other words, it returns rows
that fail to match the sub-query on the right side.

Suppose you want a list of departments with no employees.
You could write a query like this:
SELECT d.department_name
FROM departments d
MINUS
SELECT d.department_name
FROM departments d, employees e
WHERE d.department_id = e.department_id
ORDER BY department_name;

The above query will give the desired results, but it might
be clearer to write the query using an anti-join:
SELECT d.department_name
FROM departments d
WHERE NOT EXISTS (SELECT NULL
FROM employees e
WHERE e.department_id = d.department_id)
ORDER BY d.department_name;

Is This Answer Correct ?    17 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

What is the difference between a primary key and a unique key?

0 Answers  


What is the max nvarchar size?

0 Answers  


How to maintain the history of code changes of pl/sql?

3 Answers  


what is sql profiler

2 Answers   Fidelity,


how do u call in & out parameters for stored procedures?

10 Answers   A1 Technology, TCS, Techicon,


What is a recursive join sql?

0 Answers  


is it necessary to write group by and order by clause together

3 Answers   HCL, Wipro,


How delete all records from table in sql?

0 Answers  


Write a sql to print only character form the below string. @So&*CIE%$TE@GEN!@RAL

1 Answers   Societe Generale,


Explain constraints in sql?

0 Answers  


What is clause?

0 Answers  


when normalization is required

3 Answers   HCL,


Categories