1.设计表四个必须的字段:主键、创建人、创建日期、备注
2.修改数据,select * from emp for update 或使用rowid字段 需解锁,修改,关锁,提交
3.where后条件数据的大小写格式应与表中的数据一致
4.union与union all 区别:前者去重组合查询,后者非去重组合
5.求差集:minus
6.求交集:intersect
7.查询工资最高的第2-5条记录
select ename,sal from
(
select ename,sal rownum r from
(select ename,sal from emp order by nvl(sal,0) desc)
)
where r<=5 and r>=2
8.to_char()括号中逗号前填写需要初始化的日期,逗号后填写初始化日期的格式
‘yyyy’ ‘yyyy-mm’ ‘yyyy-mm-dd’ ‘yyyy-mm-dd hh24:mi:ss’
9.系统表
select * from user_tables where table name
10.查询当前时间
Select sysdate from dual
明天 sysdate+1
11.去重 distinct
12.若日期为空,设为明天
select nvl(e.hiredate,sysdate+1) from emp e
13.连接字符串,先输入’此员工的姓名为【】’,然后在需要填字段的【】中加入
’||字段名||’
14.Order by 排序四种方式 单列 多列 列别名 列位置
根据列位置排序 order by后的数字为列数