[HackerRank] Revising the Select Query II

이정진·2021년 11월 25일
0

SQL

목록 보기
10/23
post-thumbnail

Revising the Select Query II

난이도 구분 : Easy

문제

Query the NAME field for all American cities in the CITY table with populations larger than 120000. The CountryCode for America is USA.

The CITY table is described as follows:

문제 풀이

문제를 보면, 미국 도시이면서 인기도가 120000이상인 도시의 이름을 출력하라고 하고 있다.
미국 도시임을 판단하는 기준은 countrycode가 USA인 것이므로 COUNTRYCODE = 'USA'와 인기도 가 120000이상인 것을 찾는 기준인 POPULATION > 120000을 AND조건으로 조회하면 된다.

SQL

SELECT NAME 
FROM CITY
WHERE COUNTRYCODE = 'USA' AND POPULATION > 120000

0개의 댓글