oracle-DML-2
1.update 语句
update table set [column,column......] where column =''
示例: update customers
set cust_credit_limit = 20000
where cust_id = 2789;
2.delete 语句
delete from table where 条件
示例; delete from customers
where cust_state_province = 'QT';
备注;truncate customers 也可以删除该表的所有记录,但是它在出错不允许回滚的
3.数据排序
order by
示例: select cust_id,cust_state_province, cust_credit_limit
from customers
where cust_credit_limit = 15000
and cust_state_province in ('QT','CT')
order by cust_state_province ,cust_id ;
备注:oracle 默认的是按照升序排序,如果需要降序就 要在排序字段后面添加desc
示例:select cust_id ,cust_state_province,cust_credit_limit
from customers
where cust_credit_limit =15000
and cust_state_province in ('UT','CT')
order by cust_state_province ,cust_id desc
4.group by
group by 主要是分组 来进行求和 或者其它运算
示例:select prod_subcategory,avg(amout_sold)
from sales s ,products p
where s.prod_id = p.prod_id
and prod_category = 'Electronics'
group by prod_subcategory ;
5.having
在对group by 操作的使用having 字句可以限制返回的组
示例:select prod_subcategory,avg(amout_sold)
from sales s ,products p
where s.prod_id = p.prod_id
and prod_category = 'Electronics'
group by prod_subcategory
having avg(amout_sold) > 300;
6.子查询
sql 一个强大功能就是创建子查询,即查询中嵌套查询。这一功能使得基于另一结果或者其他结果集进行查询成为可能
示例:
select prod_id ,prod_name ,prod_category
from products
where prod_list_price =
(
select max(prod_list_price) from products
);
7:集合操作
union 返回两表中无任何重复的所有行
示例:select * from x
union
select *from y
union all 返回两表中所以行(包含重复)
示例:select * from x
union all
select *from y
intersect 返回两表中都存在的行
示例:select * from x
intersect
select *from y
oracle-DML-2的更多相关文章
- Oracle DML容错处理(1)
Oracle dml操作过程中可能出现键重复或者数据类型不一致等问题,一般进行数据处理时候需要对这些可能出现的错误提前考虑,避免更新失败.Oralce给出了一些其他解决方案,以在不同场景下使用. 1. ...
- oracle DML语句
DML语句 1. 插入数据 创建一个新表 create table new_cust as select * from customers --使用insert语句添加行 /* 确定要插入的行所在的 ...
- Oracle DML容错处理(2)
关于DML Error Logging效率的问题,摘自网上一篇文章,作为单独一篇说明,原文如下: DML Error Logging in Oracle 10g Database Release 2 ...
- Oracle(DML)
数据操作语言: insert update delete 事务控制语言: commit rollback savepoint 1.insert语句 两种格式: 直接插入 子查询插入 1. 直接插入基本 ...
- oracle DML错误日志(笔记)
DML错误日志是oracle10gR2引入的一个类似于SQL*Loader的错误日志功能.它的基本原理是把任何可能导致语句失败的记录转移,放到一张错误日志表中. 具体使用如下: 1.使用DBMS_ER ...
- oracle DML(数据管理语言)sql 基本语句
- oracle DML语句 事务的定义与特点
1.insert into (插入数据) insert in to 表名(列表1,列表2) values(要插入的数据1,数据2); or insert into 表名 values(数据 ...
- 转 如何观察 undo Oracle DML语句回滚开销估算
https://searchdatabase.techtarget.com.cn/7-20392/ --use_urec 详细解读: select USED_UREC from v$transacti ...
- Oracle ddl 和 dml 操作
ddl 操作 窗口设置用户权限的方法 Oracle的数据类型 按住Ctrl点击表名 ,可以鼠标操作 插入的数据需要满足创建表的检查 主表clazz删除数据从表设置级联也会一同删除 有约束也 ...
- ORACLE 11G R2 RAC classical install OGG12.1(LINUX) 经典抽取模式单项同步配置OGG12.1
博文结构图如下: 一.环境描述以及注意事项 1.1 环境简介 IP 系统 Oracle版本 OGG版本 源端 172.16.10.16/36 RHEL6.5 oracle11204 12.1 目标端 ...
随机推荐
- 33 N皇后问题
原题网址:https://www.lintcode.com/zh-cn/old/problem/n-queens/# n皇后问题是将n个皇后放置在n*n的棋盘上,皇后彼此之间不能相互攻击. 给定一个整 ...
- 密码学笔记(2)——RSA密码
上一篇笔记中讲述了大量的代数知识,这一篇中我们看看如何将这些代数知识应用到RSA密码体制中. 一.公钥密码学简介 在经典密码学的研究模型中,我们根据已选择的秘钥K得到一条加密规则$e_{k}$和一条解 ...
- momentjs 使用总结
一.安装 cnpm install moment 二.引入 var moment = require('moment') 三.使用 let today = moment().format('YYYY- ...
- PAT甲级——A1068 Find More Coins
Eva loves to collect coins from all over the universe, including some other planets like Mars. One d ...
- Python使用微信接入图灵机器人
1.wxpy库介绍 wxpy 在 itchat 的基础上,通过大量接口优化提升了模块的易用性,并进行丰富的功能扩展. 文档地址:https://wxpy.readthedocs.io 从 PYPI 官 ...
- CodeChef:Chef and Problems(分块)
CodeChef:Chef and Problems 题目大意 有一个长度为n的序列$a_1,a_2,……,a_n$,每次给出一个区间[l,r],求在区间内两个相等的数的最远距离($max(j-i,满 ...
- iftop实时监控网络流量
需要安装,linux自身不自带该命令 中间的<= =>这两个左右箭头,表示的是流量的方向. TX:发送流量 RX:接收流量 TOTAL:总流量 Cumm:运行iftop到目前时间的总流量 ...
- idea展示runDashboard的窗口
一.idea的runDashboard打开workspace.xml文件之后,找到component为RunDashboard的节点处,然后在component标签里添加<option name ...
- 线条之美,玩转SVG线条动画
线条之美,玩转SVG线条动画 作者:AlloyTeam www.alloyteam.com/2017/02/the-beauty-of-the-lines-break-lines-svg-animat ...
- JS中apply和call的联系和区别
以下内容翻译自stackoverflow 链接: http://stackoverflow.com/questions/7238962/function-apply-not-using-thisarg ...