Oracle学习笔记(五)
来源:asp之家 时间:2012-01-05 18:52:30
组合集总计:
group by with rollup/cube
grouping sets
子查询按执行方式分:标准子查询、关联子查询
标准子查询:嵌套子查询
标量值查询
case with then
使用exits查询
select user_id,user_name from tb_001 tb
where [not] exists (select 'x'
from tb_001
where manager_id=tb.user_id )
关联更新
update table1 alias1
set column=(select expression
from table2 alias2
where alias1.column=alias2.column);
关联删除
delete from table1 alias11
where column operator
(select expression
from table2 alias2
where alias1.column=alias2.column);
分层结构
分层检索
select [level],column,expr...
from table
[where with condition(s)]
[connect by prior condition(s)]
connect by prior column1=column2
top down:
colum1=parentkey
column2=childkey
bottom up:
column1=childkey
column2=parentkey
插入语句insert statement
insert into table[(column[,column...])]
values(value[,value...])
修改语句update statement
update table
set column=value[,column=value,...]
[where condition];
多表插入语句(Multitable Insert Statements)
insert [all] [conditional_insert_clause]
[insert_into_cause values_clause](subquery)
conditional_insert_clause
[all][first]
[when condition then][insert_into_clause values_clause]
[else][insert_into+clause values_clause]
列:
intsert all
into tb_user values(id,uid,upwd)
into tb_user_info values(id,name,sex,age)
select id,uid,upwd,name,sex,age
from tb_u_10
where id>10000;
待条件的多行插入
insert all
when id>11000 then
into tb_user values(id,uid,upwd)
when age>40 then
into tb_user_info values(id,name,sex,age)
select id,uid,upwd,name,sex,age
from tb_u_10
where id>10000;
insert first
when conditional then
into ...
when conditional then
into ...
else
into...
select...
创建索引
cretate table t_10
(id number(6) not null primary key using index (create index index1 on t_10(id)),
name varchar2(50));
查询索引
select * from user_indexes;
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
教你用Python创建微信聊天机器人
go语言环境搭建简述
python如何删除文件、目录
Python实现的对本地host127.0.0.1主机进行扫描端口功能示例
![](https://img.aspxhome.com/file/2023/3/124393_0s.png)
vue.js 动态组件详解
![](https://img.aspxhome.com/file/2023/0/132910_0s.png)
python3调用百度翻译API实现实时翻译
windows上彻底删除jupyter notebook的实现
vue循环中点击选中再点击取消(单选)的实现
![](https://img.aspxhome.com/file/2023/6/125276_0s.jpg)
详解Python对某地区二手房房价数据分析
![](https://img.aspxhome.com/file/2023/6/118766_0s.jpg)
python添加命令行参数的详细过程
![](https://img.aspxhome.com/file/2023/9/114629_0s.png)
python请求域名requests.(url = 地址)报错
![](https://img.aspxhome.com/file/2023/0/115830_0s.png)
当设计师遇上前端开发
一起来学习一下python的数据类型
Python实现监控内存使用情况和代码执行时间
![](https://img.aspxhome.com/file/2023/8/90948_0s.jpg)
获取Dom元素的X/Y坐标
![](https://img.aspxhome.com/file/UploadPic/200910/10/123-57s.gif)