Chinaunix首页 | 论坛 | 博客
  • 博客访问: 970298
  • 博文数量: 358
  • 博客积分: 8185
  • 博客等级: 中将
  • 技术积分: 3751
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:27
个人简介

The views and opinions expressed all for my own,only for study and test, not reflect the views of Any Company and its affiliates.

文章分类

全部博文(358)

文章存档

2012年(8)

2011年(18)

2010年(50)

2009年(218)

2008年(64)

我的朋友

分类: Oracle

2009-07-07 22:07:09

■DML:
  insert:
    ・The syntax : use either the VALUES keyword or a subquery, but not both
    × insert into t1 (c1,c2) values(select c1,c2 from t1);
    ・insert rows into several tables with one statement
     eg:
INSERT ALL
WHEN order_total < 100000 THEN
INTO small_orders
WHEN order_total > 100000 AND order_total < 200000 THEN
INTO medium_orders
ELSE
INTO large_orders
SELECT order_id, order_total, sales_rep_id, customer_id
FROM orders;
  update
  delete
  merge
    eg:
   MERGE INTO bonuses D
    USING (SELECT employee_id, salary, department_id FROM employees
    WHERE department_id = 80) S
    ON (D.employee_id = S.employee_id)
    WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
     DELETE WHERE (S.salary > 8000)
    WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
     VALUES (S.employee_id, S.salary*0.1)
     WHERE (S.salary <= 8000);
■Truncate
■For update
■Transactions control statements
  ・ACID
 ・COMMIT; ROLLBACK;
  SAVEPOINT A;
  ROLLBACK TO A;
■Data Control Language (DCL) statements
  GRANT
  REVOKE

阅读(829) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~