I am the Co-Founder of The Data Monk. I have a total of 6+ years of analytics experience
3+ years at Mu Sigma
2 years at OYO
1 year and counting at The Data Monk
I am an active trader and a logically sarcastic idiot :)
Follow Me
INNER JOIN helps us to get the common records.
Suppose we want to get the records from two tables who are having the same ID’s
select * from Table1 T1
inner join Table2 ON
T1.id = T2.id;
Answers ( 3 )
1) Using Intersect
(Select * from Employee1)
Intersect
(Select * from Employee2)
2) Using Inner join
select * from Employee1 e1
inner join Emplyee2 e2 ON
e1.id = e2.id
1. INTERSECT
SELECT emp_id , Name FROM employee1 E1
INTERSECT
SELECT emp_id , Name from employee2 E2
Note : To use intersect , columns in both the table should be same and written in same order.
2. JOIN – Equi Join / Inner Join
select E1.emp_id , E1.Name from Employee1 E1
INNER JOIN employee1 E2 ON
E1.emp_id = E2.emp_id
INNER JOIN employee3 E3
E2.emp_id = E3.emp_id
Note : If there are n number of tables , we can use inner join n-1 times to get the records which are common among them
INNER JOIN helps us to get the common records.
Suppose we want to get the records from two tables who are having the same ID’s
select * from Table1 T1
inner join Table2 ON
T1.id = T2.id;