Skip to content

CORRESPONDING

SELECT *
FROM employees
CORRESPONDING BY (job_id)
NATURAL JOIN jobs;
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL JOB_ID SALARY
-----------------------------------------------------------
100 Steven King SKING AD_PRES 24000
101 Neena Kochhar NKOCH AC_MGR 17000
102 Lex De Haan LDEHA AC_MGR 17000
. . .

The CORRESPONDING BY clause is used when performing a UNION, INTERSECT, or MINUS operation in oracle. This clause is used to specify the matching columns from the tables using their column names explicitly. It’s a way of letting Oracle take a specific column from one table and match it with the corresponding column in another table for comparison in the set operation. This example shows how CORRESPONDING BY can be used to evenly match the job_id column while joining employees and jobs table.