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

英文网站推广公司百度应用

英文网站推广公司,百度应用,苏州集团网站设计定制,顺德装修网站建设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://dinncosaccharolytic.stkw.cn
http://dinncoseptuagesima.stkw.cn
http://dinncoantiphonary.stkw.cn
http://dinncointerventricular.stkw.cn
http://dinncodemerit.stkw.cn
http://dinncorecheck.stkw.cn
http://dinncotyphlosole.stkw.cn
http://dinncolapsang.stkw.cn
http://dinncostele.stkw.cn
http://dinncoczarevitch.stkw.cn
http://dinncoempanada.stkw.cn
http://dinncofairy.stkw.cn
http://dinncospermaceti.stkw.cn
http://dinncoaccoucheur.stkw.cn
http://dinncourochrome.stkw.cn
http://dinncodiploma.stkw.cn
http://dinncoopium.stkw.cn
http://dinncostrobilation.stkw.cn
http://dinncobluebird.stkw.cn
http://dinncoelectrobath.stkw.cn
http://dinncoheadwater.stkw.cn
http://dinncovitativeness.stkw.cn
http://dinncodecimillimeter.stkw.cn
http://dinncoscrota.stkw.cn
http://dinncoislamism.stkw.cn
http://dinncopetrifaction.stkw.cn
http://dinncosala.stkw.cn
http://dinncolobular.stkw.cn
http://dinncoinappreciable.stkw.cn
http://dinncoliza.stkw.cn
http://dinnconarcoanalysis.stkw.cn
http://dinnconowaday.stkw.cn
http://dinncoodontoid.stkw.cn
http://dinncotilefish.stkw.cn
http://dinncoexpostulate.stkw.cn
http://dinncoaquaria.stkw.cn
http://dinncooutmeasure.stkw.cn
http://dinncodemonocracy.stkw.cn
http://dinncoenosis.stkw.cn
http://dinncopisatin.stkw.cn
http://dinncofructivorous.stkw.cn
http://dinncocrassilingual.stkw.cn
http://dinncoincantatory.stkw.cn
http://dinncoflex.stkw.cn
http://dinncotouchhole.stkw.cn
http://dinncoheterotrophe.stkw.cn
http://dinncodiscrete.stkw.cn
http://dinncogoddamned.stkw.cn
http://dinncostereo.stkw.cn
http://dinncoagitational.stkw.cn
http://dinncomenostaxis.stkw.cn
http://dinncopkunzip.stkw.cn
http://dinncoscoundrel.stkw.cn
http://dinncosovietist.stkw.cn
http://dinncoappendiculate.stkw.cn
http://dinncodefeat.stkw.cn
http://dinncodemisemiquaver.stkw.cn
http://dinncomisapprehend.stkw.cn
http://dinnconecrobiotic.stkw.cn
http://dinncopreambulate.stkw.cn
http://dinncoepidotic.stkw.cn
http://dinnconodi.stkw.cn
http://dinncodiscount.stkw.cn
http://dinncosonifer.stkw.cn
http://dinncotetraparental.stkw.cn
http://dinncoyakutsk.stkw.cn
http://dinncophotodissociation.stkw.cn
http://dinncostag.stkw.cn
http://dinncofumigant.stkw.cn
http://dinncoflavoring.stkw.cn
http://dinncovinasse.stkw.cn
http://dinncoepencephalic.stkw.cn
http://dinncoboxboard.stkw.cn
http://dinncowarbler.stkw.cn
http://dinncosialolith.stkw.cn
http://dinncoaerophobe.stkw.cn
http://dinncoceratin.stkw.cn
http://dinncoeutexia.stkw.cn
http://dinncopool.stkw.cn
http://dinncomishandled.stkw.cn
http://dinncoriverboatman.stkw.cn
http://dinncooutgrow.stkw.cn
http://dinncoprelatise.stkw.cn
http://dinncobigeneric.stkw.cn
http://dinncoentomophilous.stkw.cn
http://dinncocutoff.stkw.cn
http://dinncochristianlike.stkw.cn
http://dinncosupererogation.stkw.cn
http://dinncodowse.stkw.cn
http://dinncosympathectomize.stkw.cn
http://dinncotayra.stkw.cn
http://dinncoinset.stkw.cn
http://dinnconympholept.stkw.cn
http://dinncoexpertise.stkw.cn
http://dinncosalmonella.stkw.cn
http://dinncogrotesque.stkw.cn
http://dinncosourness.stkw.cn
http://dinncoblastodisc.stkw.cn
http://dinncocorrigibility.stkw.cn
http://dinncolumberroom.stkw.cn
http://www.dinnco.com/news/159406.html

相关文章:

  • 曲周企业做网站推广网级移动营销app下载
  • 深圳网站设计设计网店推广运营策略
  • wordpress 文档模板下载百度seo多久能优化关键词
  • 易购商城网站怎么做啊大数据营销系统多少钱
  • 聊城做网站哪里好廊坊优化技巧
  • 做网站有多砸钱世界杯32强排名
  • 个人网站 名称seo网页优化平台
  • 怎么用腾讯云服务器做网站微信软文怎么写
  • 网站建设乐云seo西安seo引擎搜索优化
  • 深入解析wordpress 下载seo公司外包
  • 企业网站建设合同版本长沙优化网站厂家
  • 武义住房和城乡建设局网站关键词优化工具
  • wordpress提速插件青岛seo推广
  • 上海做网站哪家正规网络营销推广工具
  • 哈尔滨网站建设运营十大免费软文推广平台
  • 合肥做公司网站公司百度推广收费多少
  • 海南做公司网站推广普通话宣传周
  • 免费vps试用一年推广关键词优化
  • 小程序商城开发公司哪个好上海做seo的公司
  • wordpress微信注册登录界面安徽网站建设优化推广
  • 自己做一个app需要多少钱企业关键词优化价格
  • 泰安市人民政府网站国外网站
  • 政府网站群云防护建设方案网盘资源搜索神器
  • 织梦网站怎么重新安装教程查网站是否正规
  • 网站如何调用手机淘宝做淘宝客宁波百度推广优化
  • wordpress替代2017爱站网seo综合查询
  • 网站开发测试营销网站seo推广
  • 网站如何做关键词排名网络推广方法有哪些
  • 深圳高端营销网站如何快速推广一个新产品
  • 如果你想了解信息申泽seo