ソースコード
SELECT A.ITEM_CODE as 'ITEMA', B.ITEM_CODE as 'ITEMB',

CAST(COUNT(*) as REAL) /  (SELECT CAST(COUNT(*) as REAL) FROM  (SELECT MEMBER_CODE FROM   PURCHASE_HISTORY GROUP BY  MEMBER_CODE)) * 100  AS 'SUPPORT',
CAST(COUNT(*) as REAL) /  (SELECT CAST(COUNT(*) as REAL) FROM  (SELECT MEMBER_CODE FROM   PURCHASE_HISTORY WHERE ITEM_CODE = A.ITEM_CODE GROUP BY  MEMBER_CODE)) * 100  AS 'CONFIDENCE',
CAST(COUNT(*) as REAL) /  (SELECT CAST(COUNT(*) as REAL) FROM  (SELECT MEMBER_CODE FROM   PURCHASE_HISTORY WHERE ITEM_CODE = A.ITEM_CODE GROUP BY  MEMBER_CODE)) / ((SELECT CAST(COUNT(*) as REAL) FROM  (SELECT MEMBER_CODE FROM   PURCHASE_HISTORY WHERE ITEM_CODE = B.ITEM_CODE GROUP BY  MEMBER_CODE)) / (SELECT CAST(COUNT(*) as REAL) FROM  (SELECT MEMBER_CODE FROM   PURCHASE_HISTORY GROUP BY  MEMBER_CODE))) as 'LIFT'

FROM 
 (select  SESSION_ID, ITEM_CODE , MEMBER_CODE
  FROM    PURCHASE_HISTORY
 ) A
LEFT JOIN
 (select  SESSION_ID, ITEM_CODE , MEMBER_CODE
  FROM    PURCHASE_HISTORY
 ) B
ON A.SESSION_ID = B.SESSION_ID AND A.MEMBER_CODE = B.MEMBER_CODE AND
      A.ITEM_CODE <> B.ITEM_CODE
WHERE B.ITEM_CODE IS NOT NULL
GROUP BY A.ITEM_CODE, B.ITEM_CODE;


提出情報
提出日時2024/05/24 18:54:15
コンテスト第11回 SQLコンテスト
問題アソシエーション分析
受験者katsuno
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量83 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
83 MB
データパターン2
WA
83 MB
データパターン3
WA
83 MB