[SQL๋ฌธ์ ํ๊ธฐ - Advent of SQL 2025 ๐ ] ์ฌ๋ฆผํฝ ๋ฉ๋ฌ์ด ์๋ ๋ฐฐ๊ตฌ ์ ์
Dec 10, 2025
๋ฌธ์
๋ด๊ฐ ์์ฑํ ์ ๋ต
MySQL, SQLite
select a.id, a.name, group_concat(r.medal) medals
from records r
join athletes a on a.id = r.athlete_id
where r.team_id in (select id from teams where team = 'KOR')
and r.event_id in (select id from events where event = 'Volleyball Women''s Volleyball')
and r.medal is not null
group by a.id;PostgreSQL
select a.id, a.name, string_agg(r.medal,',') medals
from records r
join athletes a on a.id = r.athlete_id
where r.team_id in (select id from teams where team = 'KOR')
and r.event_id in (select id from events where event = 'Volleyball Women''s Volleyball')
and r.medal is not null
group by a.id;Share article