ソースコード
WITH CleanedData AS (
    SELECT 
        EMP_CODE as CODE, 
        EMP_LAST_NAME as SURNAME, 
        EMP_FIRST_NAME as NAME, 
        REPLACE(EMP_LAST_NAME,' ', '') AS cleaned_surname, 
        REPLACE(EMP_FIRST_NAME,' ', '') AS cleaned_name
    FROM EMP
    WHERE VALID_FLG=1
)
SELECT 
    c.CODE, 
    c.SURNAME, 
    c.NAME
FROM 
    CleanedData c
INNER JOIN 
    CleanedData c2 ON c.cleaned_surname = c2.cleaned_surname 
                  AND c.cleaned_name = c2.cleaned_name 
                  AND c.CODE != c2.CODE
WHERE 
    (c.cleaned_surname, c.cleaned_name) IN (
        SELECT 
            cleaned_surname, cleaned_name
        FROM 
            CleanedData
        GROUP BY 
            cleaned_surname, cleaned_name
        HAVING 
            COUNT(*) > 1
    ) 
ORDER BY 
    c.cleaned_surname ASC, 
    c.cleaned_name ASC, 
    c.CODE ASC;
提出情報
提出日時2023/12/11 08:50:50
コンテスト第5回 SQLコンテスト
問題同姓同名抽出
受験者doro
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量83 MB
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
WA
83 MB
データパターン3
AC
83 MB