INNER JOIN
INNER JOIN returns all rows whose joining field/column values exist in the tables. It may be easy to visualize it from a Venn diagram perspective where Tables A and B are the two circles. The inner join is represented by the intersection of the two tables. An example of this is seen below.
INNER JOIN in ACTION
To demonstrate
employees table
select employee_id, email, department_id, phone from employees limit 10;
departments table
select * from departments;
Now we implement the INNER JOIN, returning all instances that exist at the intersection of tables A and B.
SELECT
a.employee_id,
a.email,
a.phone,
b.department_name,
b.budget, b.location
FROM employees a
INNER JOIN departments b
USING (department_id)
ORDER BY employee_id
LIMIT 10;
USING and WHERE Clause VS. ON
You will notice that in the INNER JOIN, I am using