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的更多相关文章

  1. Oracle DML容错处理(1)

    Oracle dml操作过程中可能出现键重复或者数据类型不一致等问题,一般进行数据处理时候需要对这些可能出现的错误提前考虑,避免更新失败.Oralce给出了一些其他解决方案,以在不同场景下使用. 1. ...

  2. oracle DML语句

    DML语句 1.  插入数据 创建一个新表 create table new_cust as select * from customers --使用insert语句添加行 /* 确定要插入的行所在的 ...

  3. Oracle DML容错处理(2)

    关于DML Error Logging效率的问题,摘自网上一篇文章,作为单独一篇说明,原文如下: DML Error Logging in Oracle 10g Database Release 2 ...

  4. Oracle(DML)

    数据操作语言: insert update delete 事务控制语言: commit rollback savepoint 1.insert语句 两种格式: 直接插入 子查询插入 1. 直接插入基本 ...

  5. oracle DML错误日志(笔记)

    DML错误日志是oracle10gR2引入的一个类似于SQL*Loader的错误日志功能.它的基本原理是把任何可能导致语句失败的记录转移,放到一张错误日志表中. 具体使用如下: 1.使用DBMS_ER ...

  6. oracle DML(数据管理语言)sql 基本语句

  7. oracle DML语句 事务的定义与特点

    1.insert into (插入数据) insert in to  表名(列表1,列表2)    values(要插入的数据1,数据2); or insert into 表名   values(数据 ...

  8. 转 如何观察 undo Oracle DML语句回滚开销估算

    https://searchdatabase.techtarget.com.cn/7-20392/ --use_urec 详细解读: select USED_UREC from v$transacti ...

  9. Oracle ddl 和 dml 操作

      ddl 操作 窗口设置用户权限的方法  Oracle的数据类型  按住Ctrl点击表名 ,可以鼠标操作  插入的数据需要满足创建表的检查  主表clazz删除数据从表设置级联也会一同删除 有约束也 ...

  10. 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 目标端 ...

随机推荐

  1. myeclipse启动jboss报ERROR [MainDeployer] Could not create deployment

    今天用myeclipse启动jboss时报了这样的错,花了我将近一天的时间去解决这个问题,开始以为jar包问题,到最后发现是配置错了,所以分享一下.具体报错信息如下图: ERROR [MainDepl ...

  2. python 之 heapq (堆)

    堆的实现通过构造二叉堆,实为二叉树的一种:这种数据结构具有以下性质: 任意节点小于(或大于)它的后裔,最小元(或最大元)在堆的根上 堆总是一颗完整树.即除了最低层,其它层的节点都被元素填满,且最低层极 ...

  3. [Turn]C# 强制关闭当前程序进程(完全Kill掉不留痕迹)

    C#代码 /// <summary> /// 运行DOS命令 /// DOS关闭进程命令(ntsd -c q -p PID )PID为进程的ID /// </summary> ...

  4. boost 日期时间计算

    示例代码如下: #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_ ...

  5. centos Python2.6 升级到2.7

    需求: centos 6.x 系统默认Python 版本都是2.6,实际生产环境中需要用到Python 2.7.x Python 2.7 下载地址 [root@ansible package]# wg ...

  6. JS两个相同的字符串被判断为不相等问题

    今天在写js的时候,遇到一个奇怪的问题,明明两个字符串相等,用alert()打印出来都一样,typeof的结果都是string, 仔细查看过了首尾都没有空格. 可是用a==b却判断为不相等 后来在网上 ...

  7. 通过原生JS打印一个空心菱形图案

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  8. Sql Server实现自动增长

    在学习中遇到这个问题 数据库里有编号字段 BH00001 BH00002 BH00003 BH00004 如何实现自动增长 --下面的代码生成长度为8的编号,编号以BH开头,其余6位为流水号. --得 ...

  9. Leetcode475.Heaters供暖器

    冬季已经来临. 你的任务是设计一个有固定加热半径的供暖器向所有房屋供暖. 现在,给出位于一条水平线上的房屋和供暖器的位置,找到可以覆盖所有房屋的最小加热半径. 所以,你的输入将会是房屋和供暖器的位置. ...

  10. Python之常用文件操作

    Python之常用文件操作