You are on page 1of 1

UNION UNION ALL INTERSECT MINUS in

Returns the combined rows from two queries, sorting them and removing duplicates. Returns the combined rows from two queries without sorting or removing duplicates. Returns only the rows that occur in both queries result sets, sorting them and removing duplicates. Returns only the rows in the first result set that do not appear the second result set, sorting them and removing duplicates.

**UNION --display current and previous job details of all employees SQL>select employee_id,department_id,job_id from employees union select employee_id,department_id,job_id from job_history; **UNION ALL --display the current and previous department_id of all employees SQL>select employee_id, job_id from employees union all select employee_id , job_id from job_history; **INTERSECT --Only those employees whose job_details have not changed SQL>select employee_id,department_id,job_id from employees intersect select employee_id,department_id,job_idfrom job_history; **MINUS --Display employee who have not changed their job since joining SQL>select employee_id,department_id,job_id from employees minus select employee_id,department_id,job_id from job_history

You might also like