交友约会| 杂志期刊| 小说| 论坛| 电影下载| 两性知识| 电脑知识| 汽车| 旅游| 收藏

SQL Server开发者Oracle快速入门

来源: 作者: 出处:综艺读书 2007-06-27 进入讨论组
关 键 词:数据库  word  windows xp  windows 98  sybase  
下一页 1 2 
    本文参考"Beginning SQL: Differences Between SQL Server and Oracle-A Quick Intro for SQL Server Users",作者Les Kopari
 
本文比较适合刚接触Oracle的SQL Server开发人员. 
I.                   简单概念的介绍
1.       连接数据库
S:    use mydatabase
O:    connect username/password@DBAlias
       conn username/password@DBAlias
 
2.       在Oracle中使用Dual, Dual是Oracle一个特有的虚拟表, Oracle中很多系统的变量和函数都可以通过Dual中获得
S:    select getdate();
O:    select sysdate from dual;
 
3.       Select Into和Insert 语句的使用, 在SQL Server中的Select Into语句在Oracle中一般是Insert into…select…, 另外2个数据库都支持标准的SQL, 写法上略有区别
S:    select getdate() mycolumn into mytable;
       Insert mytable values(‘more text’);
O:    insert into mytable select getdate() mycolumn from dual
insert into mytable (mycolumn) values(sysdate);
 
4.       Update语句
S:    update mytable set mycolumn=myothertable.mycolumn  
from mytable,myothertable 
where mytable.mycolumn like 'MY%' and myothertable.myothercolumn='some text';
O:    update mytable set mycolumn=
(select a.mycolumn from myothertable a
where myothertable.myothercolumn='some text')
where mytable.mycolumn like 'MY%';
 
5.       Delete语句
S:    delete mytable where mycolumn like 'some%';
O:    delete from mytable where mycolumn like 'some%';
 
6.       使用开发管理的软件
S:    isql
osql: for queries developed in SQL Analyzer
SQL Server Management Studio Express     图形化管理工具
O:    sqlplus
       PL/SQL Developer 图形化开发管理工具
       TOAD                   图形化开发管理工具
 
注: 个人建议基本的简单的Select, Update, Delete使用标准的SQL语句,如SQL92或SQL99的定义
 
II.                一些细节问题: Joins, Subqueries, Deletes
1.       Outer Join 外连接
S:    select d.deptname, e.ename from dept d, emp e where d.empno *= e.enum;
O:    select d.deptname,e.ename from dept d, emp e where d.empno = e.enum (+);
 
2.       SubQueries in Place of Columns
S:    select distinct year,
q1 = (select Amount amt FROM sales where Quarter=1 AND year = s.year),
q2 = (SELECT Amount amt FROM sales where Quarter=2 AND year = s.year),
q3 = (SELECT Amount amt FROM sales where Quarter=3 AND year = s.year),
q4 = (SELECT Amount amt FROM sales where Quarter=4 AND year = s.year)
from sales s;
O:    SELECT year,
DECODE( quarter, 1, amount, 0 ) q1,
DECODE( quarter, 2, amount, 0 ) q2,
DECODE( quarter, 3, amount, 0 ) q3,
DECODE( quarter, 4, amount, 0 ) q4
FROM sales s;
 
3.       Delete with Second From Clause
S:    delete from products, product_deletes
where products.a = product_deletes.a
and products.b = product_deletes.b
and product_deletes.c = 'd';
O:    delete from products
where (a, b ) in
(select a, b from product_deletes where c = 'd' );
 
更多文章 更多内容请看Oracle 10g基础应用  Oracle基础  Oracle开发专题,或进入讨论组讨论。
下一页 1 2 
收藏此文】【 】【打印】【关闭
相关图文阅读
频道图文推荐
综艺读书宗旨
相关专题
·SQL Server 数据处理专题 (1442篇文章)
·SQL Server 索引和查询专题 (2632篇文章)
·SQL Server (1405篇文章)
·Solaris基础知识入门 (3658篇文章)
·Oracle 10g基础应用 (4026篇文章)
·Wlan组网----家庭专题 (3306篇文章)
·SQL Server开发 (55篇文章)
·SQL Server基础 (48篇文章)
·PL/SQL (404篇文章)
·Oracle开发 (227篇文章)
热点标签: 数据库  word  windows xp  windows 98  sybase  
最新技术文档
站内各频道最新更新文档
站内最新制作专题
热门关键字导读
Photoshop教 程照片处理 照片制作 PS快捷键 抠图
计 算 机 故 障XP系统修复
艺 术 与 设 计设计 流媒体 设计欣赏 边框
计 算 机 安 全ARP
站内频道文章精选
百度推荐,商机无限
搜索您感兴趣的内容
Web 全站
综艺电脑频道编辑信箱  告诉我们您想看的专题或文章

友情互链 | 收藏本站 | 联系我们 | 在线留言 | 京ICP备08008424号|