join 3

Average Population of Each Continent - BASIC JOIN

제목 그대로 각 지역의 인구 평균을 구하는 문제이다. avg 평균을 이용해야하며, floor를 이용해야 한다 - > 소수점 자리 버림. 또한 group by를 이용해서 그룹을 지어줘야한다 -> 문제 : 모든 대륙의 이름(COUNTRY.Continent)과 각 대륙의 평균 도시 인구(CITY.Population)를 가장 가까운 정수로 내림하여 쿼리합니다. Given the CITY and COUNTRY tables, query the names of all the continents (COUNTRY.Continent) and their respective average city populations (CITY.Population) rounded down to the nearest integer. Note:..

Algorithm & SQL/SQL 2022.06.09

African Cities - BASIC JOIN

이전 문제와 푸는 방법은 비슷하다. 혼자 복습할 수 있는 문제였다. 문제를 풀때, 테이블이 어떤 key로 이어져있는지 확인하고 inner join 을 이용해서 country의 continent 값이 africa 인 city 이름을 모두 출력하면 되는 문제였다. Given the CITY and COUNTRY tables, query the names of all cities where the CONTINENT is 'Africa'. Note: CITY.CountryCode and COUNTRY.Code are matching key columns. Input Format The CITY and COUNTRY tables are described as follows: 정답 : select city.name..

Algorithm & SQL/SQL 2022.06.09

Population Census - BASIC JOIN

SQL join 문을 문제를 풀면서 연습하고 싶어서 join 문제를 풀어보았다. city 테이블과 country 테이블이 2개 존재하며, continent 가 asia 인 인구수를 구하는 문제이다. join할 수 있는 key는 city 테이블의 countrycode 와 country 의 code 이다. Given the CITY and COUNTRY tables, query the sum of the populations of all cities where the CONTINENT is 'Asia'. Note: CITY.CountryCode and COUNTRY.Code are matching key columns. Input Format The CITY and COUNTRY tables are desc..

Algorithm & SQL/SQL 2022.06.09