728x90
💻 문제 주소 : Revising the Select Query I | HackerRank
Revising the Select Query I | HackerRank
Query the data for all American cities with populations larger than 100,000.
www.hackerrank.com
💻 문제
Query all columns for all American cities in the CITY table with populations larger than 100000. The CountryCode for America is USA. The CITY table is described as follows:
Column name | Type |
ID | Number |
Name | Varchar2(17) |
CountryCode | Varchar2(3) |
District | Varchar2(20) |
Population | Number |
💻 코드 미리보기
* 본 문제는 MYSQL로 작성했습니다.
더보기
select *
from city
where population > 100000 and CountryCode = "USA"
💻 문제 풀이
이 문제는 출력해야 하는 조건을 그대로 where절에 입력하기만 하면 된다. 우리가 출력해야 할 조건은 아래와 같다.
1️⃣ Population > 100000
2️⃣ CountryCode = USA
이때 이 둘을 동시에 만족해야 하기에 And 를 통해 조건을 교집합으로 이어주고,
728x90
반응형
'SQL > HackerRank' 카테고리의 다른 글
[SQL] Weather Observation Station 18 (0) | 2024.05.03 |
---|---|
[SQL] The PADS (0) | 2024.04.30 |
[SQL] Weather Observation Station 5 (0) | 2024.04.24 |
[SQL] Weather Observation Station 3 (0) | 2024.03.12 |