This is a document Template
 
SQL:

select e.empno, e.ename, e.job, e.sal from emp e where e.DEPTNO IN (select DEPTNO from DEPT e2 where e2.LOC = 'CHICAGO')

select e.empno, e.ename, e.job, e.deptno from emp e where e.DEPTNO IN ( 10, 30)

select e.empno, e.ename, e.job, e.deptno from emp e where e.DEPTNO IN ( 10,(select DEPTNO from DEPT e2 where e2.LOC = 'CHICAGO'))

NATURAL JOINS

SELECT ENAME, JOB , DEPTNO, LOC FROM EMP NATURAL JOIN DEPT WHERE DEPTNO = 30 AND DEPTNO = 10

SELECT ENAME, JOB , DEPTNO, LOC FROM EMP NATURAL JOIN DEPT WHERE DEPTNO = 30 OR DEPTNO =10

Working advantages: In natural or equijoins joins the columns form both the tables can be included in query script. In contrast, query in the outer script does not have the information of the table and columns in embedded query, therefore can't use implicitly.

The joins provides wide selection of columns from two tables, whereas the sub-queries impose  filtering-logistics / restrictions on the columns from the second table.

 

ORACLE:

NATURAL JOIN:

POSTGRESQL:

SUBQUERY

NATURAL JOIN

MYSQL

SUB QUERY

NATURAL JOIN