ソースコード
SELECT
    EMP_CODE AS CODE,
    emp1.EMP_LAST_NAME AS SURNAME,
    emp1.EMP_FIRST_NAME AS NAME
FROM (
    SELECT
        *,
        REPLACE(EMP_LAST_NAME, " ", "") AS last_name,
        REPLACE(EMP_FIRST_NAME, " ", "") AS first_name
    FROM
        EMP
    WHERE
        VALID_FLG = 1
) AS emp1
INNER JOIN (
    SELECT
        *
    FROM (
        SELECT
            EMP_LAST_NAME,
            EMP_FIRST_NAME,
            COUNT(1) AS cnt
        FROM (
            SELECT
                REPLACE(EMP_LAST_NAME, " ", "") AS EMP_LAST_NAME,
                REPLACE(EMP_FIRST_NAME, " ", "") AS EMP_FIRST_NAME
            FROM
                EMP
            WHERE
                VALID_FLG = 1
        )
        GROUP BY
            EMP_LAST_NAME,
            EMP_FIRST_NAME
    )
    WHERE
        cnt >= 2
) AS logs
ON
    emp1.last_name = logs.EMP_LAST_NAME
    AND emp1.first_name = logs.EMP_FIRST_NAME
ORDER BY
    emp1.last_name ASC,
    emp1.first_name ASC,
    EMP_CODE ASC
提出情報
提出日時2023/02/19 23:37:28
コンテスト第5回 SQLコンテスト
問題同姓同名抽出
受験者koya_346
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量94 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
94 MB
データパターン2
AC
78 MB
データパターン3
AC
79 MB