Oracle 常见问题整理,来自CSDN帖子
来源:互联网 发布:淘宝神笔模板怎么用 编辑:程序博客网 时间:2024/06/01 11:51
1、DDL, DML和DCL 的不同
(1)DDL is Data Definition Language statements. Some examples: CREATE,ALTER,DROP,RUNCATE (emove all records from a table, including all spaces allocated for the records are removed),COMMENT(dd comments to the data dictionary ),GRANT,EVOKE(ithdraw access privileges given with the GRANT command )
(2)DML is Data Manipulation Language statements. Some examples: SELECT,INSERT,UPDATE,DELETE(deletes all records from a table, the space for the records remain), CALL(call a PL/SQL or Java subprogram), EXPLAIN PLAN (explain access path to data ),LOCK TABLE (control concurrency )(3)DCL is Data Control Language statements. Some examples: COMMIT - save work done SAVEPOINT - identify a point in a transaction to which you can later roll back ROLLBACK - restore database to original since the last COMMIT SET TRANSACTION - Change transaction options like what rollback segment to use
2.去除表中重复行。
(1)
DELETE FROM table_name A WHERE ROWID > ( SELECT min(rowid) FROM table_name B WHERE A.key_values = B.key_values);(2)
create table table2 as select distinct * from table1; drop table1; rename table2 to table1;(3)
Delete from mytable where rowid not in( select max(rowid) from mytable group by column_name );(4)
delete from mytable t1 where exists (select 'x' from my_table t2 where t2.key_value1 = t1.key_value1 and t2.key_value2 = t1.key_value2 ... and t2.rowid > t1.rowid);
3.得到一个表所有的索引信息
select * from ml_tindex('mytable');
4.generate primary key values for a table
CREATE SEQUENCE sequence_name START WITH 1 INCREMENT BY 1;UPDATE table_name SET seqno = sequence_name.NEXTVAL;
</pre><p></p></blockquote><p>5.对一列的值作范围内的统计</p><p></p><p><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><p><pre name="code" class="sql"> select jgbh, sum(decode(greatest(age,59), least(age,100), 1, 0)) "年龄60-100", sum(decode(greatest(age,30), least(age, 59), 1, 0)) "年龄30-59", sum(decode(greatest(age, 0), least(age, 29), 1, 0)) "年龄0-29" from pepole group by jgbh;
0 0
- Oracle 常见问题整理,来自CSDN帖子
- 从csdn上整理的帖子1
- 面试常见问题整理----oracle
- oracle 常见问题 整理
- 来自EYGLE的帖子。
- CSDN论坛 c/c++大版 2011-10 帖子整理(整理中)
- 来自CSDN
- 帖子整理汇总
- SQL经典帖子整理
- CSDN首个帖子
- csdn 帖子:关于软件设计
- CSDN经典帖子收集
- Csdn帖子缺陷
- CSDN中的帖子链接
- csdn怎么编辑帖子???
- CSDN 优秀的帖子
- CSDN帖子的标题
- 整理的一个csdn的帖子,关于C++中的对齐的
- 深入Android开发之--理解View#onTouchEvent
- 手机管理应用研究【3】—— 垃圾清理篇
- Struts2系统学习(7)Action中取得请求参数的方法总结
- 读书笔记:virtual关键字分析
- JavaScript中的this
- Oracle 常见问题整理,来自CSDN帖子
- Java中volatile的作用以及用法
- [Shell]使用find命令查找最近修改过的文件
- ci Controller.php解析
- Github上iOS开源项目分类及
- ARM7 低级错误
- HDU 3277 Marriage Match III 二分+网络流拆点
- linux:SUID、SGID详解
- 理解JavaScript的作用域链