[SQL๋ฌธ์ œํ’€๊ธฐ - Advent of SQL 2025 ๐ŸŽ…] ์˜ฌ๋ฆผํ”ฝ ๋ฉ”๋‹ฌ์ด ์žˆ๋Š” ๋ฐฐ๊ตฌ ์„ ์ˆ˜

silver's avatar
Dec 10, 2025
[SQL๋ฌธ์ œํ’€๊ธฐ - Advent of SQL 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

silver