I just stumbled upon something in ORACLE SQL (not sure if it\'s in others), that I am curious about. I am asking here as a wiki, since it\'s hard to try to search symbols in
IN- Equal to any member in the list
ANY- Compare value to **each** value returned by the subquery
ALL- Compare value to **EVERY** value returned by the subquery
ANY() - more than minimum
=ANY() - equivalent to IN
>ALL() - more than the maximum
eg:
Find the employees who earn the same salary as the minimum salary for each department:
SELECT last_name, salary,department_id
FROM employees
WHERE salary IN (SELECT MIN(salary)
FROM employees
GROUP BY department_id);
Employees who are not IT Programmers and whose salary is less than that of any IT programmer:
SELECT employee_id, last_name, salary, job_id
FROM employees
WHERE salary 'IT_PROG';
Employees whose salary is less than the salary ofall employees with a job ID of IT_PROG and whose job is not IT_PROG:
SELECT employee_id,last_name, salary,job_id
FROM employees
WHERE salary 'IT_PROG';
....................
Hope it helps. -Noorin Fatima