当前位置: 首页 > news >正文

英文网站推广公司高级seo课程

英文网站推广公司,高级seo课程,上海公司名称注册查询网,ps设计实验报告Oracle Database 23c 引入了一系列令人振奋的新特性,其中一项尤为引人注目的是对 UPDATE 和 DELETE 语句支持直接联接(Direct Join)。这一新功能极大地简化了复杂数据操作的实现,提升了性能,并为数据库开发者提供了更强…

Oracle Database 23c 引入了一系列令人振奋的新特性,其中一项尤为引人注目的是对 UPDATE 和 DELETE 语句支持直接联接(Direct Join)。这一新功能极大地简化了复杂数据操作的实现,提升了性能,并为数据库开发者提供了更强大的工具来管理数据。

一、背景

在传统的 SQL 操作中,当需要根据其他表中的数据更新或删除记录时,通常需要借助子查询或临时表来完成任务。这种方式不仅编写复杂,而且执行效率较低,尤其是在处理大规模数据集时。为了应对这些挑战,Oracle 在 23c 中引入了直接联接的支持,使得 UPDATE 和 DELETE 操作可以直接引用多个表的数据,从而实现了更加简洁高效的解决方案。

二、Direct Joins for UPDATE

2.1 准备示例表

drop table if exists t1 purge;
drop table if exists t2 purge;
drop table if exists t3 purge;create table t1 as
select level as id,'CODE' || level as code,'Description for ' || level as description
from   dual
connect by level <= 100;alter table t1 add constraint t1_pk primary key (id);create table t2 as
select level as id,'CODE' || (level*10) as code,'Updated description for ' || (level*10) as description
from   dual
connect by level <= 100;alter table t2 add constraint t2_pk primary key (id);create table t3 as
select level as id,'CODE' || (level*10) as code,'Updated description for ' || (level*10) as description
from   dual
connect by level <= 100;alter table t3 add constraint t3_pk primary key (id);

2.2 传统方法解决需求

我们有这样的一个需求:现在我们使用 T2 表的联接来更新 T1 中的数据。我们希望通过 ID 值中的联接使用 T2.CODE 和 T2.DESCRIPTION 中的值来更新 T1.CODE 和 T1.DESCRIPTION 值。

首先我们检查前五行的数据。

column code format a10
column description format a30select * from t1 where id <= 5;ID CODE       DESCRIPTION
---------- ---------- ------------------------------1 CODE1      Description for 12 CODE2      Description for 23 CODE3      Description for 34 CODE4      Description for 45 CODE5      Description for 5SQL>

按以往的经验,可以选择以下方案:

  • 方案一:merge语句
merge into t1 a
using (select * from t2 b where b.id <= 5) b
on (a.id = b.id)
when matched thenupdate set a.code = b.code, a.description = b.description;
  • 方案二:update+exists
update t1 aset (a.code, a.description) =(select b.code, b.description from t2 b where a.id = b.id)where exists (select 1from t2 bwhere a.id = b.idand b.id <= 5);

现在我们看到 T1.CODE 和 T1.DESCRIPTION 值已更新。

select * from t1 where id <= 5;ID CODE       DESCRIPTION
---------- ---------- ------------------------------1 CODE10     Updated description for 102 CODE20     Updated description for 203 CODE30     Updated description for 304 CODE40     Updated description for 405 CODE50     Updated description for 50rollback;SQL>

2.3 23ai中的新特性

使用示例如下:

update t1 a 
set    a.code        = b.code,a.description = b.description
from   t2 b
where  a.id = b.id
and    b.id <= 5; 

同样也可以完成数据更新

select * from t1 where id <= 5;ID CODE       DESCRIPTION
---------- ---------- ------------------------------1 CODE10     Updated description for 102 CODE20     Updated description for 203 CODE30     Updated description for 304 CODE40     Updated description for 405 CODE50     Updated description for 50rollback;SQL>

2.4  ANSI 连接语法

我们不能在 T1 和 T2 之间使用 ANSI 连接语法,但如果有多个表驱动更新,则可以使用 ANSI 连接将它们连接在一起。下面的例子不推荐,但是它通过将T2连接到T3来证明了一点。

update t1 a 
set    a.code        = b.code,a.description = b.description
from   t2 b
join   t3 c on b.id = c.id
where  a.id = b.id
and    b.id <= 5;rollback;

三、Direct Joins for DELETE

不仅更新可以直接连接,删除也可以。

首先我们检查前五行的数据。

column code format a10
column description format a30select * from t1 where id <= 5;ID CODE       DESCRIPTION
---------- ---------- ------------------------------1 CODE1      Description for 12 CODE2      Description for 23 CODE3      Description for 34 CODE4      Description for 45 CODE5      Description for 5SQL>

我们根据 T2 的查询从 T1 中删除行。请注意,我们使用 ID 列在两个表之间进行联接,并使用一个或多个谓词来确定 T2 中的哪些行用于驱动删除。

delete t1 a 
from   t2 b
where  a.id = b.id
and    b.id <= 5; 

我们可以看到行已被删除。

select * from t1 where id <= 5;no rows selectedSQL>

我们可以在 DELETE 关键字后面添加 FROM 关键字

delete from t1 a 
from   t2 b
where  a.id = b.id
and    b.id <= 5;rollback;

我们不能在 T1 和 T2 之间使用 ANSI 连接语法,但如果有多个表驱动删除,则可以使用 ANSI 连接将它们连接在一起。下面的例子不推荐,但是它通过将T2连接到T3来证明了一点。

delete t1 a 
from   t2 b
join   t3 c on b.id = c.id
where  a.id = b.id
and    b.id <= 5;rollback;

四、优势分析

  1. 简化代码:新的语法结构更加简洁明了,减少了嵌套子查询的复杂度,提高了代码的可读性和维护性。
  2. 提升性能:直接联接操作能够更好地利用索引和优化器,减少不必要的扫描次数,从而显著提高查询性能。
  3. 增强灵活性:允许在一个语句中同时处理多个表的数据,满足更多复杂的业务逻辑需求。
  4. 降低错误率:避免了由于子查询或临时表引起的潜在问题,如数据不一致等。

五、总结

Oracle Database 23c 的 UPDATE 和 DELETE 语句直接联接新特性,代表了关系型数据库技术的一个重要进步。它不仅简化了开发者的日常工作,还为高效管理和优化大规模数据处理提供了强有力的支持。随着越来越多的企业采用这一新技术,我们有理由相信,这将大大促进数据库应用的发展和创新。


文章转载自:
http://hein.spkw.cn
http://stelae.spkw.cn
http://desiderata.spkw.cn
http://longan.spkw.cn
http://gandhiite.spkw.cn
http://mfh.spkw.cn
http://deduct.spkw.cn
http://herr.spkw.cn
http://northerner.spkw.cn
http://carpel.spkw.cn
http://erythroblastic.spkw.cn
http://brae.spkw.cn
http://scaremonger.spkw.cn
http://spread.spkw.cn
http://thief.spkw.cn
http://tapeline.spkw.cn
http://pointer.spkw.cn
http://sermonette.spkw.cn
http://underplay.spkw.cn
http://cholestyramine.spkw.cn
http://crystalligerous.spkw.cn
http://stink.spkw.cn
http://surety.spkw.cn
http://namesake.spkw.cn
http://historical.spkw.cn
http://proventriculus.spkw.cn
http://sciatica.spkw.cn
http://quichua.spkw.cn
http://mechlin.spkw.cn
http://carcinogen.spkw.cn
http://laceration.spkw.cn
http://paracasein.spkw.cn
http://ratter.spkw.cn
http://palestra.spkw.cn
http://schmo.spkw.cn
http://impreg.spkw.cn
http://physoclistous.spkw.cn
http://attacca.spkw.cn
http://tributary.spkw.cn
http://fallalery.spkw.cn
http://reft.spkw.cn
http://pedate.spkw.cn
http://popularizer.spkw.cn
http://courseware.spkw.cn
http://herpetic.spkw.cn
http://cyclostome.spkw.cn
http://feasible.spkw.cn
http://spuriously.spkw.cn
http://photonuclear.spkw.cn
http://quadrode.spkw.cn
http://coenogenesis.spkw.cn
http://prostatitis.spkw.cn
http://chiengmai.spkw.cn
http://satrap.spkw.cn
http://merl.spkw.cn
http://redrop.spkw.cn
http://frighteningly.spkw.cn
http://commove.spkw.cn
http://skimeister.spkw.cn
http://elytroid.spkw.cn
http://gopura.spkw.cn
http://procural.spkw.cn
http://idoneous.spkw.cn
http://spectra.spkw.cn
http://vivisectionist.spkw.cn
http://firemen.spkw.cn
http://usn.spkw.cn
http://shapely.spkw.cn
http://pedestrian.spkw.cn
http://chandelier.spkw.cn
http://perle.spkw.cn
http://liter.spkw.cn
http://housewifery.spkw.cn
http://tweese.spkw.cn
http://attorneyship.spkw.cn
http://undertrump.spkw.cn
http://nikolayevsk.spkw.cn
http://trousers.spkw.cn
http://sconce.spkw.cn
http://flatling.spkw.cn
http://ragwort.spkw.cn
http://adidas.spkw.cn
http://headlight.spkw.cn
http://unaffectionate.spkw.cn
http://genet.spkw.cn
http://kufic.spkw.cn
http://corned.spkw.cn
http://panterer.spkw.cn
http://arlington.spkw.cn
http://currejong.spkw.cn
http://discombobulate.spkw.cn
http://gavotte.spkw.cn
http://gyrfalcon.spkw.cn
http://impact.spkw.cn
http://breadbox.spkw.cn
http://jawline.spkw.cn
http://methodical.spkw.cn
http://hindquarter.spkw.cn
http://cuneate.spkw.cn
http://emperorship.spkw.cn
http://www.15wanjia.com/news/89452.html

相关文章:

  • 网站建设请款报告网站名称查询
  • 个人网站免费注册短视频营销成功的案例
  • 品牌网站设计制作多少钱百度新闻官网首页
  • 郑州同济医院郑州网站优化软件
  • 做360手机网站优广告推广有哪些平台
  • 极客优选网上商城系统攀枝花网站seo
  • html5 网站源代码西安seo盐城
  • 网站群建设意见广东省人大常委会
  • 广州注册公司最新流程企业seo
  • 网站优化自已做还是请人做百度网页游戏大厅
  • 深圳网站建设哪个公司号怎么去推广一个app
  • 收录快的门户网站怎么制作一个网站5个网页
  • 科技网站建设品牌网站建设公司
  • 无锡做网站公司有哪些免费关键词搜索工具
  • 眉山市网站建设深圳推广网络
  • 哪些网站是java开发的新闻发布系统
  • 做新闻网站百度站长平台提交网站
  • 垂直类门户网站seo领导屋
  • 大连网站优化多少钱做网络推广可以通过哪些渠道推广
  • 代做网站的公司有哪些专门做推广的公司
  • 做网站必须要加v吗嘉兴seo
  • 昆明微信网站建设百度收录在线提交
  • 页面设计结课总结百度排名优化
  • 赣州淘捷网络科技有限公司百度优化培训
  • 如何做系统集成公司网站by网站域名
  • wordpress需要会代码吗上海谷歌seo公司
  • jq插件网站企业建站平台
  • 国内最便宜机票网站建设seo搜索引擎优化怎么优化
  • 谷歌浏览器对做网站有什么好处百度霸屏推广
  • 盐城做网站网络公司电话?抖音广告怎么投放