gpt4 book ai didi

SQL 查询比较

转载 作者:行者123 更新时间:2023-12-01 10:54:23 25 4
gpt4 key购买 nike

Tables A and B in action.
A [commonfield, otherfields]
B [commonfield]

查询 1

select
A.otherfields
from
A,B
where
A.commonfield = B.commonfield
and some filters ( A.commonfield )

查询 2

select
A.otherfields
from
A
where
A.commonfield in ( select B.commonfield from B )
and some filters ( A.commonfield )

查询 1 等同于查询 2。在 (a) 内存使用和 (b) 速度方面哪个更好?

最佳答案

最好的和符合 ANSI 标准的方法是

查询#3:

select
A.otherfields
from
A
inner join
B ON A.commonfield = B.commonfield
where
some filters ( A.commonfield )

关于SQL 查询比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16200074/

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