gpt4 book ai didi

mysql - 将 oracle 查询转换为 MySQL 查询

转载 作者:行者123 更新时间:2023-11-29 08:27:16 25 4
gpt4 key购买 nike

我正在尝试将此查询从 Oracle 转换为 MySQL:

CREATE TABLE SCT_201301_UMLS_SYN 
AS SELECT DISTINCT A.SCUI "SNOMED_CODE", A.STR "SNOMED_DISPLAY_NAME"
, B.STR "UMLS_SYNONYM"
FROM MRCONSO A, MRCONSO_UMLS B
WHERE A.SCUI IN (SELECT referencedComponentId
FROM SnomedCTtoICD10)
AND A.SAB='SNOMEDCT'
AND A.SUPPRESS='N'
AND A.TTY='PT'
AND B.LAT='ENG'
AND B.SUPPRESS='N'
AND A.CUI=B.CUI

有什么想法可以做到这一点吗?

最佳答案

如果您使用的是旧版本的 MySQL,那么您可能会遇到 in 的性能问题。这是一个替代方案,它应该适用于 MySQL 和 Oracle:

CREATE TABLE SCT_201301_UMLS_SYN 
AS SELECT DISTINCT A.SCUI "SNOMED_CODE", A.STR "SNOMED_DISPLAY_NAME"
, B.STR "UMLS_SYNONYM"
FROM MRCONSO A join
MRCONSO_UMLS B
on A.CUI = B.CUI
WHERE exists (SELECT 1
FROM SnomedCTtoICD10 s
where s.referencedComponentId = a.scui)
AND A.SAB='SNOMEDCT'
AND A.SUPPRESS='N'
AND A.TTY='PT'
AND B.LAT='ENG'
AND B.SUPPRESS='N'

关于mysql - 将 oracle 查询转换为 MySQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17600071/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com