0

PRODUCT と ACCOUNT の 2 つのテーブルがあります。

PRODUCT 表の列

product_id   (PK)                      
subscription_id 

ACCOUNT テーブルの列

account_nbr
subscription_id  
  (account_nbr and subscription_id are primary key columns in account table)
... Other columns  

account_nbrsubscription_idを見つけなければなりませんproduct_id

入力として取得product_idします。それを使用してsubscription_id from PRODUCT table、ACCOUNT テーブルから値をsubscription_id取得できます。account_nbr

2 つのクエリで情報を取得する代わりに、1 つのクエリで情報を取得できますか?

以下のようなもの:

select distinct a.acct_nbr,p.subscription_id 
from ACCOUNT  a,PRODUCT p
where v.product_id = ' val 1' and 
v.subscription_id  = p.subscription_id 

上記のクエリのパフォーマンスは、2 つの個別のクエリに比べて低くなりますか?

4

1 に答える 1