Oracle_071_lesson_p3
远程登录conn hr/hr@192.168.133.117:1521/orcl l
SQL->awhere> SQL->c/whree/where修改语句
SQL->r执行
清空buff
clear buff
删除行号
del 行号
del5
删除多行
del 行号1 行号2
del 2 3
增加行
SQL> i where 1=1;在最后增加
SQL>0select 在最前增加
SQL>1 where 1=1;改变第1行的内容
报告SQL>@?/rdbms/admin/awrrpt #?表示$ORACLE_HOME
SAVE filename
GET filename
START filename
@filename
EDITfilename
SPOOLfilename
EXIT filename
set AutoTRACE 执行计划
where 子句
select * from emp where employee_id=100;
where='字符串'注意格式和加单引号如dd-MON-RR03-AUG-08
除了=,还有>>= < =10000 and job_id like '%MAN%'
where salary >=10000 or job_id like '%MAN%'
where job_idnot 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字段最重要
selecta,b from tab
order by 1 desc , 2 desc ;
1,2表示select后的字段序号 ,不建议使用1,2,3之类的排序语法;
TOP N 取值
offset
fetch first
with ties 即有并列值也输出
如取前10行
orderbysalary desc
fetch first 10 rows only;
取前6-10行
orderbysalary 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
页:
[1]