Difference between Equi-Join and Inner-Join in SQL
I have 2 tables called 'table123' and 'table246'.
'table123' columns: 'ID', 'Dept_ID', 'First_Name', 'Surname', 'Salary', 'Address'.
'table246' columns: 'Dept_ID', 'Dept_Name'.
I'm looking for a list of employees with the lowest salaries in each department. I can accomplish it in two ways: an Equi-Join or an Inner-Join. I've been informed they can both be utilized to get the desired outcome. I used the following queries:
Equi-Join:
SELECT First_Name, b.Dept_Name, alt.Min_Salary AS Min_Salary
FROM table123 a, table246 b,
(SELECT Dept_ID, MIN(Salary)Min_Salary
FROM table123
GROUP BY Dept_ID)alt
WHERE a.Dept_ID = b.Dept_ID
AND a.salary = alt.Min_Salary
AND a.Dept_ID = alt.Dept_ID;Inner-Join:
SELECT MIN(Salary)Min_Salary, Dept_Name
FROM table123 a, table246 b
INNER JOIN (SELECT First_Name, MIN(Salary)
FROM table123
GROUP BY Dept_ID)alt
ON b.Dept_ID = alt.Dept_ID;The Equi-Join command returns the appropriate table, with the columns 'First Name,' 'Dept Name,' and 'Min Salary' having all essential data.
The Inner-Join statement, however, does not execute because the First Name column must be included in the aggregate function or GROUP BY clause. This perplexes me since I have no idea how to solve it. After reading this article, I gained some knowledge but did not fully get it. How can I make the Inner-Join query produce the same results as the Equi-Join query?

