SELECT * FROM emp;
#指定结果集的列
SELECT empno , ename FROM emp;
#别名
SELECT e.empno AS eno, e.ename AS en, e.job AS j FROM emp AS e;
#去重
SELECT DISTINCT job , deptno FROM emp;
#全集
SELECT ALL * FROM emp;
#交集
SELECT job , deptno FROM emp
UNION ALL
SELECT empno , ename FROM emp;
SELECT job , deptno FROM emp
UNION
SELECT empno , ename FROM emp;

#表达式
SELECT * , "所有数据后，固定加一个字符串" str FROM emp;
SELECT ename , sal * 12 year_sal FROM emp;
SELECT ename , NULL FROM emp;

#where子句
SELECT * FROM emp WHERE deptno = 10 AND sal > 3000;
SELECT * FROM emp WHERE deptno = 10 OR sal > 1500;

SELECT * FROM emp WHERE comm IS NULL;
SELECT * FROM emp WHERE comm IS NOT NULL;

SELECT * FROM emp WHERE sal NOT BETWEEN 1500 AND 3000;
SELECT * FROM emp WHERE sal >= 1500 AND sal <= 3000;

SELECT * FROM emp WHERE deptno = 10 OR deptno = 30;
SELECT * FROM emp WHERE deptno IN (10 , 30);
SELECT * FROM emp WHERE deptno NOT IN (10 , 30);


SELECT * FROM emp WHERE ename LIKE '%O%';
SELECT * FROM emp WHERE ename LIKE '__O%';
SELECT * FROM emp WHERE ename NOT LIKE '%O%';
SELECT * FROM emp WHERE ename = 'SCOTT';