基本查詢
select * from emp;
set linesize
col empno for
col ename for a
set pagesize
select empno
select empno
select empno as "員工編號"
select distinct deptno from emp;
select distinct deptno
select ename ||
注意
SQL 語言大小寫不敏感
SQL 可以寫在一行或者多行
關鍵字不能被縮寫也不能分行
各子句一般要分行寫
使用縮進提高語句的可讀性
過濾和排序
select * from v$nls_parameters;
alter session set NLS_DATE_FORMAT=
select * from emp where hiredate=
select * from emp where hiredate=to_date(
select * from emp where sal>=
select * from emp where sal between
select * from emp where deptno=
select * from emp where deptno in (
select * from emp where ename like
select * from emp where ename like
select * from emp where ename like
select * from emp where comm is not null;
select * from emp order by sal;
a desc
select empno
select empno
select empno
select * from emp order by deptno
select * from emp order by deptno desc
select * from emp order by comm desc nulls last;
set feedback off/set feedback on
排序的規則
可以按照select語句中的列名排序
可以按照別名列名排序
可以按照select語句中的列名的順序值排序
如果要按照多列進行排序
From:http://tw.wingwit.com/Article/program/Oracle/201311/19117.html