Oracle学习笔记(五)
发布时间:2024-01-25 04:12:09
组合集总计:
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;


猜你喜欢
- 在用pymysql操作数据库的过程中,给sql语句传参碰到了很多问题,网上传参策略很多,这里推荐两种单个传参用%s,写起来比较简单:fiel
- 大量的多行段落本身就会降低可读性,同时空行分段也比空格分段有更高的可适应性...前文讨论的热烈程度远超我预期,正好还有之前查阅资料拍的几张实
- 背景构建和测试大型项目时都会很耗时,且容易出错。开发者在开发过程中需要不断执行go build、go run 、go test等相关命令。还
- 什么是性能分析?性能分析是衡量应用程序在代码级别的相对性能。性能分析将捕捉的事件包括:CPU的使用,内存的使用,函数的调用时长和次数,以及调
- 本文实例讲述了php数组索引与键值操作技巧。分享给大家供大家参考。具体如下:<?php $array = array("a&
- 一、原理核心思想比较简单。即通过不同旋转角度的模板同时匹配,在多个结果中,找到相似度最大的结果,即认为匹配成功。 在视频的某一帧将这些模板分
- 目录什么是引用计数怎么查看引用计数?对象的引用计数数组的引用计数关于内存泄露需要注意的地方总结什么是引用计数在PHP的数据结构中,引用计数就
- 我们在使用很多新闻系统的时候,都会发现一个问题,尤其是使用 HtmlEdit 从WORD文档中直接拷贝文章(尤其里面有复杂表格和文字)的时候
- 一、绘制折线图import seaborn as snsimport numpy as npimport pandas as pdimpor
- 下面两个函数的使用和FIND_IN_SET一样,使用时只需要把FIND_IN_SET换成FIND_PART_IN_SET或FIND_ALL_
- 目录一、简单字段定义1、定义 Schema 并生成 Parquet 文件2、验证 Parquet 数据文件二、含嵌套字段定义1、验证 Par
- 本文将详细解释这些函数的使用方法。首先,我们介绍Python语言中类似于Windows系统的dir命令的列出文件功能,然后描述如何测试一个文
- tcp粘包产生的原因这里就不说了,因为大家能搜索TCP粘包的处理方法,想必大概对TCP粘包有了一定了解,所以我们直接从处理思路开始讲起tcp
- 引子: 今天看到别人的一个题目: function fn(x){ x = 10; arguments[0] = 20; console.lo
- 本地环境设置在这里我们介绍设置Go编程语言环境,需要在你的计算机上的准备以下两个软件,(A)文本编辑器和(B)Go编译器。文本编辑器这将用来
- linux中,可以使用指令pip install lmdb安装lmdb包。----lmdb 数据库文件生成增 改 删查1、生成一个空的lmd
- 引言GO虽然不消耗大量内存,但是仍有一些小技巧可以节省内存,良好的编码习惯是每一个程序员都应该具备的素质。预先分配切片数组是具有连续内存的相
- 首先得明确包和模块。包:在一个目录下存在__init__.py,那么该目录就是一个包。模块:一个.py文件就是一个模块。我们可以通过from
- 我最近花了一些时间在探索CPython,并且我想要在这里分享我的一些冒险经历。Allison Kaptur的excellent guide
- 正在看的ORACLE教程是:自动备份Oracle数据库。