SQL SELECT Queries Examples

Here is a list of simple SQL SELECT Queries examples. These queries are for beginners of sql.

SELECT * FROM EMP;
—————————————
SELECT * FROM DEPT;
—————————————-
SELECT ENAME,EMPNO FROM EMP;
——————————————-
SELECT DNAME FROM DEPT;
——————————————

SELECT * FROM EMP WHERE ENAME=’WARD’;
———————————————
SELECT ENAME “EMPLOYEE NAME” FROM EMP;
———————————————
SELECT DEPTNO FROM EMP;
——————————————
SELECT EMPNO,ENAME,DEPTNO FROM EMP

WHERE DEPTNO=20; ——————————————-
SELECT ENAME FROM EMP WHERE SAL BETWEEN 2000 AND 4000;
——————————————
SELECT ENAME FROM EMP WHERE SAL NOT BETWEEN 2000 AND 4000
———————————————-
SELECT EMPNO FROM EMP WHERE ENAME LIKE ‘W%’
———————————————–
SELECT EMPNO FROM EMP WHERE ENAME NOT LIKE ‘W%’
——————————————
SELECT EMPNO,ENAME FROM EMP WHERE DEPTNO IN (10,20)
————————-
SELECT EMPNO,ENAME FROM EMP WHERE DEPTNO IN (10,20)

Add Comment