SQL->a where> SQL->c /whree/where 修改语句
SQL->r 执行
清空buff
clear buff
删除行号
del 行号
del 5
删除多行
del 行号1 行号2
del 2 3
增加行
SQL> i where 1=1; 在最后增加
SQL>0 select 在最前增加
SQL>1 where 1=1; 改变第1行的内容
报告SQL>@?/rdbms/admin/awrrpt #?表示$ORACLE_HOME
SAVE filename
GET filename
START filename
@ filename
EDIT filename
SPOOL filename
EXIT filename
set AutoTRACE 执行计划
where 子句
select * from emp where employee_id=100;
where='字符串' 注意格式和加单引号 如dd-MON-RR 03-AUG-08
除了=,还有> >= < =10000 and job_id like '%MAN%'
where salary >=10000 or job_id like '%MAN%'
where job_id not in ('IT_PROG','SA_REP')
where 子句操作优先级 参考lesson_p3-20页
1.括号 2.连接. 3.......
排序 order by
默认升序 asc
降序desc
order by salary ;
order by salary desc;
order by salary,department_id desc;
多字段排序,order by 后跟的第1字段最重要
select a,b from tab
order by 1 desc , 2 desc ;
1,2表示select后的字段序号 ,不建议使用1,2,3之类的排序语法;
TOP N 取值
offset
fetch first
with ties 即有并列值也输出
如取前10行
order by salary desc
fetch first 10 rows only;
取前6-10行
order by salary desc
offset 5 rows fetch next 5 rows only;
前2行有相同值会一并输出
order by salary desc
fetch first 2 rows with ties;
替换变量(&和&&)
where department_id = &department_id