Select NAME, D.DEPTNO, DEPTNAME FROM EMP E, DEPT D WHERE E.DEPTNO = D.DEPTNO
SELECT field1, field2, field3 FROM first_table INNER JOIN second_table ON first_table.keyfield = second_table.foreign_keyfield
SELECT * FROM A INNER JOIN B ON A.SID=B.SID
A = Plumbers, B = ElectriciansNow if you wish to write a query which enlists all the plumbers and also those electricians which are plumbers, you will need a Left Outer Join.
SELECT A.NAME, B.NAME FROM A LEFT JOIN B ON A.SID=B.SID