This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- SOCCER_SQL_016-- SOCCER_SQL_016 | |
| -- 평균키가 인천 유나이티스팀의 평균키 보다 작은 팀의 | |
| -- 팀ID, 팀명, 평균키 추출 | |
| select t.team_id as "팀ID", | |
| t.team_name as "팀명", | |
| round(avg(p.height),2) as "평균키" | |
| from team t | |
| join player p | |
| on t.team_id = p.team_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- SOCCER_SQL_011 | |
| -- 팀과 스타디움을 조인하여 | |
| -- 팀이름, 스타디움 이름 출력 | |
| select * from team | |
| select * from stadium | |
| SELECT | |
| stadium_name 스타디움, | |
| coalesce(t.team_name, '홈팀이 없음') 팀명 | |
| FROM stadium s | |
| LEFT JOIN team t ON s.hometeam_id = t.team_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- SOCCER_SQL_011 | |
| -- 팀과 스타디움을 조인하여 | |
| -- 팀이름, 스타디움 이름 출력 | |
| select * from team | |
| select * from stadium | |
| SELECT | |
| stadium_name 스타디움, | |
| coalesce(t.team_name, '홈팀이 없음') 팀명 | |
| FROM stadium s | |
| LEFT JOIN team t ON s.hometeam_id = t.team_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select player_name, | |
| coalesce(height, 0) || 'cm', | |
| coalesce(weight, 0) || 'kg' | |
| from player | |
| where team_id = 'K02' | |
| order by height asc; | |
| -- SQL_TEST_007 -- 수원팀(ID: K02) 선수들 이름, | |
| -- 키와 몸무게 리스트 (단위 cm 와 kg 삽입) | |
| -- 키와 몸무게가 없으면 "0" 표시 -- BMI지수 -- 키 내림차순 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 001. 전체 축구팀 목록을 팀이름 오름차순으로 출력하시오 | |
| SELECT team_name | |
| FROM team | |
| ORDER BY team_name COLLATE "C" ASC; | |
| -- 002. 플레이어의 포지션 종류를 나열하시오. 단 중복은 제거하고, 포지션이 없으면 빈공간으로 두시오 | |
| SELECT DISTINCT | |
| COALESCE(position, '') AS position | |
| FROM player | |
| ORDER BY position ASC; |