数据开发面试必备

oracle----------------------------------
数据类型:
数字:
integer 整数
number 任何数字,整数和小数
number(长度,精度)

字符串:
char(长度) 2000
varchar2(长度) 4000

时间:
date

大文件:4GB
blob 二进制文件 图片视频,过时的文件类型
clob 大文本格式

DCL:
grant 权限 to 用户;
revoke 权限 from 用户;

DDL:
create user 用户名 identified by 密码;
create table 表名(列名 数据类型 约束条件);
create view 视图名 as select语句;
create materialized view 物化视图名 refresh on commit | on demand start with sysdate next 下一个启动的时间 as select语句;
create index 索引 on 表名(列名);
create sequence 序列号名 start with 开始 increment by 自增数 maxvalue xx minvalue yy cycle cache;

alter:
alter user 用户名 identified by 新密码;
alter user 用户名 account unlock;
alter table 表名 rename to 新表名;
alter table 表名 add 列名 数据类型 约束条件;
alter table 表名 modify 列名 数据类型 约束条件;
alter table 表名 drop column 列名;
alter table 表名 rename column 旧列名 to 新列名;
alter table 表名 add constraint 约束名 约束类型(列名); alter table emp add constraint pk_empno primary key(empno);
alter table 表名 drop constraint 约束名;

drop:
drop 对象类型 对象名字;
drop table 表名;
drop user 用户名;
drop view 视图名;

truncate:
truncate table 表名;

DML:
insert into 表名(列名) values(值);
insert into 表名(列名) select 语句;

update 表名 set 列名=新值 where 筛选条件;

delete from 表名 where 筛选条件;

DQL:
select 列名 5
from 表名 1
where 筛选条件 2
group by 分组 3
having 聚合筛选 4
order by 排序; 6

子查询,句子的嵌套的查询

联合查询:select * from a [inner|left|right|full] join b on a.xx=b.yy;
select * from a,b where a.xx=b.yy;
select * from a,b where a.xx=b.yy(+);
select * from a,b where a.xx(+)=b.yy;
select * from a,b where a.xx=b.yy(+) union select * from a,b where a.xx(+)=b.yy;
内连接:
左连接:
a 1 2 3
b 2 3 4
select * from a left join b on a.id=b.id and a.id=2;
1 null
2 2
3 null

select * from a left join b on a.id=b.id where a.id=2;
2 2

右连接:
全连接:
2 2
3 3
1 null
null 4

集合运算:union all和union的区别?
union all
union
minus
intersect

函数:
聚合 max min avg sum count
单行:
数字 abs round trunc ceil floor pow mod
字符串 substr concat length upper lower initcap replace
日期 last_day add_months months_between
转换 to_char to_number to_date
空值替换 nvl nvl2
逻辑处理 decode sign
行列转换 pivot
select * from (select deptno,sal from emp)
pivot(avg(sal) for deptno in(10,20,30));

select avg(case when deptno=10 then sal else null end) d10,
avg(case when deptno=20 then sal else null end) d20,
avg(case when deptno=30 then sal else null end) d30
from emp;

分析函数:xxx() over(partition by 分组 order by 排序 asc|desc)
排名:row_number rank dense_rank
平移:lag lead

视图:
create view 视图名 as select语句 with read only;
视图的优点:1.sql语句的简化 2.节省网络流量 3.简化业务逻辑 4.安全性较好
视图里面不应该写太复杂的语句

物化视图:
on commit:如果对应的数据源表发生了变更并且进行了commit提交,物化视图也一起更新
on demand:进行定时更新的操作
更新有两种方法:complete 全量更新 fast 增量更新 force 默认的更新(就是fast)
物化视图和视图的区别?
1.视图是虚拟的,物化视图是实际的表
2.视图是实时更新,物化视图有两种更新方式
3.物化视图还可以添加索引等信息
4.视图不会占用磁盘,物化视图会占用磁盘

物化视图也叫做快照表,一般用来保存过去某个时间点的表格数据,进行数据的备份。

索引:
类型: 位图 主键 唯一 普通 组合 函数 分区索引(全局 本地)
bitmap和btree两种索引的区别?
oracle的索引是通过什么来搜索数据的? rowid
不同的索引在不同的什么场景下使用?
分区表的全局和本地索引的区别是什么?
索引在什么时候会失效?
索引是不是越多越好?
怎么样快速的进行大表格的数据新增?

分区:
分区表的类型:列表 散列 范围 组合
不同的分区表分别在什么场景下使用?
分区表的创建语法:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一凡888

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值