展示を表示し、COSTSテーブルとPROMOTIONSテーブルの構造を調べます。 プロモーションコストがプロの最高コストのPRODIDよりも低いPRODIDを表示したい モーション時間間隔。 このSQLステートメントを調べてください。 SELECT prod id FROMコスト WHEREプロモーションID (SELECTプロモーションID プロモーションから WHERE promo_cost <ALL (SELECT MAX(プロモーション費用) プロモーションから GROUP BY(promo_end date-promo_begin_date))); 結果はどうなりますか?
正解:D
This SQL query checks for product IDs (prod_id) from the costs table where the promotion ID (promo_id) is associated with promotions whose costs are less than the maximum promotional cost of all promotions, grouped by the duration of each promotion (calculated as promo_end_date - promo_begin_date). The query is correctly written to fulfill these conditions. * The subquery SELECT MAX(promo_cost) FROM promotions GROUP BY (promo_end_date - promo_begin_date) computes the maximum cost of promotions grouped by their duration, returning the highest cost for each distinct promotion length. * The WHERE promo_cost < ALL (...) clause then filters out the promotions where the promo_cost is less than all of the maximum costs returned by the subquery, ensuring that only promo_ids associated with costs less than the highest cost for any promotion length are considered. * Since this logical structure correctly implements the given requirement, the statement executes successfully and yields the correct results.