It returns all matched records from both (Left and right) tables, based on given condition.
Example: Below three queries return same result.
1. Using on condition:
SELECT
A.ID
,A.First_Name
,A.Last_Name
,A.Dept_ID
,B.Dept_Name
FROM EMP A
INNER JOIN DEPT B
ON A.Dept_ID = B.Dept_ID
2. Using Where condition:
SELECT
A.ID
,A.First_Name
,A.Last_Name
,A.Dept_ID
,B.Dept_Name
FROM EMP A,
DEPT B
WHERE A.Dept_ID = B.Dept_ID
3. We can mention 'JOIN' instead of 'INNER JOIN'.
SELECT
A.ID
,A.First_Name
,A.Last_Name
,A.Dept_ID
,B.Dept_Name
FROM EMP A
JOIN DEPT B
ON A.Dept_ID = B.Dept_ID
Example: Below three queries return same result.
1. Using on condition:
SELECT
A.ID
,A.First_Name
,A.Last_Name
,A.Dept_ID
,B.Dept_Name
FROM EMP A
INNER JOIN DEPT B
ON A.Dept_ID = B.Dept_ID
2. Using Where condition:
SELECT
A.ID
,A.First_Name
,A.Last_Name
,A.Dept_ID
,B.Dept_Name
FROM EMP A,
DEPT B
WHERE A.Dept_ID = B.Dept_ID
3. We can mention 'JOIN' instead of 'INNER JOIN'.
SELECT
A.ID
,A.First_Name
,A.Last_Name
,A.Dept_ID
,B.Dept_Name
FROM EMP A
JOIN DEPT B
ON A.Dept_ID = B.Dept_ID
No comments:
Post a Comment