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;

标签:Oracle,学习笔记
0
投稿

猜你喜欢

  • 基于canvas的二维码邀请函生成插件

    2024-04-17 10:40:53
  • Python定时发送消息的脚本:每天跟你女朋友说晚安

    2023-05-26 02:47:14
  •  SQL 中 CASE 表达式的使用方式

    2024-01-23 14:18:47
  • 在vue中使用防抖和节流,防止重复点击或重复上拉加载实例

    2024-05-22 10:28:01
  • 利用Go语言实现轻量级OpenLdap弱密码检测工具

    2024-04-25 15:30:43
  • JS 中对象equals方法的实现

    2020-07-08 03:49:19
  • python3的pip路径在哪

    2023-01-27 14:15:39
  • 如何用python 实现老板键功能

    2022-09-30 10:13:25
  • python实现五子棋程序

    2022-05-26 23:24:31
  • Go错误处理之panic函数和recover函数使用及捕获异常方法

    2024-02-13 02:16:12
  • vue+Element实现登录随机验证码

    2024-05-29 22:48:34
  • python中startswith()和endswith()的用法详解

    2023-11-02 12:41:09
  • 蚁群算法js版

    2008-10-08 10:15:00
  • Python中tkinter+MySQL实现增删改查

    2024-01-20 06:49:59
  • 实例简析XPath串函数和XSLT

    2008-09-04 14:16:00
  • vuex actions异步修改状态的实例详解

    2024-05-10 14:12:50
  • Rel与CSS的联合使用

    2010-02-20 13:03:00
  • 深入分析Python中Lambda函数的用法

    2023-07-01 16:03:21
  • 类型为search的input及相关属性

    2009-02-11 12:49:00
  • 浅谈python锁与死锁问题

    2022-06-02 16:38:37
  • asp之家 网络编程 m.aspxhome.com