inblog logo
|
silver
    SQL문제풀기

    [SQL문제풀기] 멀티 플랫폼 게임 찾기

    silver's avatar
    silver
    Sep 21, 2025
    [SQL문제풀기] 멀티 플랫폼 게임 찾기
    Contents
    문제SQLite

    문제

    solvesql.com
    solvesql.com
    https://solvesql.com/problems/multiplatform-games/

    SQLite

    내가 작성한 오답1

    notion image
    notion image

    내가 작성한 오답2

    : count()는 “null이 아닌 값”의 개수를 셈
    → 게임이 Sony 계열 플랫폼 3개(PS3, PS4, PSV)에 나왔으면 count 값이 3이 됨.
    → distinct 계열 수를 세야 함
    select g.name from games g join platforms p on g.platform_id = p.platform_id and p.name in ('PS3', 'PS4', 'PSP', 'PSV','Wii', 'WiiU', 'DS', '3DS','X360', 'XONE') where year >= 2012 group by g.name having count( case when p.name in ('PS3', 'PS4', 'PSP', 'PSV') then 'Sony' when p.name in ('Wii', 'WiiU', 'DS', '3DS') then 'Nintendo' when p.name in ('X360', 'XONE') then 'Microsoft' end ) >= 2

    내가 작성한 정답

    select g.name from games g join platforms p on g.platform_id = p.platform_id and p.name in ('PS3', 'PS4', 'PSP', 'PSV','Wii', 'WiiU', 'DS', '3DS','X360', 'XONE') where year >= 2012 group by g.name having count(distinct case when p.name in ('PS3', 'PS4', 'PSP', 'PSV') then 'Sony' when p.name in ('Wii', 'WiiU', 'DS', '3DS') then 'Nintendo' when p.name in ('X360', 'XONE') then 'Microsoft' end ) >= 2;
    Share article

    silver

    RSS·Powered by Inblog