コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
WITH
total AS (
SELECT
COUNT(DISTINCT SESSION_ID) AS total_count
FROM
PURCHASE_HISTORY
)
SELECT
combi_count.ITEM_CODE,
combi_count.ITEM_CODE2,
ROUND(CAST(combi_count.order_count AS REAL) / total_count * 100, 5) AS SUPPORT,
ROUND(CAST(combi_count.order_count AS REAL) / item_count.order_count * 100, 5) AS CONFIDENCE,
ROUND(CAST(combi_count.order_count AS REAL) / item_count.order_count / AllBuyY.order_count, 5) AS LIFT
FROM
total,
(
SELECT
ITEM_CODE,
COUNT(DISTINCT SESSION_ID) AS order_count
FROM
PURCHASE_HISTORY
GROUP BY
ITEM_CODE
) AS item_count
INNER JOIN (
SELECT
X.ITEM_CODE AS ITEM_CODE,
Y.ITEM_CODE AS ITEM_CODE2,
COUNT(DISTINCT X.SESSION_ID) AS order_count
FROM
PURCHASE_HISTORY AS X
INNER JOIN PURCHASE_HISTORY Y ON X.SESSION_ID = Y.SESSION_ID
AND X.ITEM_CODE <> Y.ITEM_CODE
GROUP BY
X.ITEM_CODE,
Y.ITEM_CODE
) AS combi_count ON combi_count.ITEM_CODE = item_count.ITEM_CODE
INNER JOIN (
SELECT
ITEM_CODE,
CAST(COUNT(DISTINCT SESSION_ID) AS REAL) / (
SELECT
COUNT(DISTINCT SESSION_ID)
FROM
PURCHASE_HISTORY
) AS order_count
FROM
PURCHASE_HISTORY
GROUP BY
ITEM_CODE
) AS AllBuyY ON combi_count.ITEM_CODE2 = AllBuyY.ITEM_CODE
ORDER BY
LIFT desc,
SUPPORT desc,
CONFIDENCE desc,
combi_count.ITEM_CODE desc;
提出情報
提出日時 | 2024/05/27 11:34:30 |
コンテスト | 第11回 SQLコンテスト |
問題 | アソシエーション分析 |
受験者 | otsuneko |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 86 MB |
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
86 MB
データパターン3
WA
83 MB