Simple Query in SQL in EMP Table
1.
SELECT DISTINCT SAL
FROM EMP;
2.
SELECT JOB, SAL, EMPNO, ENAME FROM EMP
WHERE JOB='MANAGER';
3.
SELECT JOB, SAL, ENAME,EMPNO FROM EMP
WHERE JOB='MANAGER' AND EMPNO=7698;
4.
SELECT ENAME, JOB SAL FROM EMP
WHERE ENAME='KING' OR JOB='MANAGER';
5.
SELECT *FROM EMP
WHERE NOT ENAME='KING';
-- DEFUALT TAKING ASC ORDER BY
6.
SELECT DISTINCT SAL, EMPNO, ENAME
FROM EMP
ORDER BY SAL, EMPNO;
7
SELECT DISTINCT SAL, EMPNO, ENAME
FROM EMP
ORDER BY SAL DESC;
-- BOTH ARE USED TO ASCDESING AND DESCDEING ORDER.
8
SELECT *FROM EMP
ORDER BY EMPNO ASC, SAL DESC;
9
SELECT EMPNO, JOB, MGR, SAL
FROM EMP
WHERE MGR IS NOT NULL;
10.
SELECT EMPNO, JOB, MGR, SAL
FROM EMP
WHERE MGR IS NULL;
0 Comments