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 |
What can sql server reporting services do?
What is error ora-01000: maximum open cursors exceeded
how to check the 3rd max salary from an employee table?
what is definer rights invoke rights?
What are the advantages and disadvantages, compared to the standard SQL and SQL*plus ?
how can i create a user defined datatype
Why should I use postgresql?
Can we use rowid as primary key?
How do I debug a stored procedure?
what is commit? : Sql dba
what is the command line end user interface - mysql? : Sql dba
explain about mysql and its features. : Sql dba