Database
해커랭크 SQL문제_0712
starlikedh
2021. 7. 12. 15:54
Revising the Select Query I
문제:
Query all columns for all American cities in the CITY table with populations larger than 100000.
The CountryCode for America is USA.
풀이:
문제를 해석해보면 populations이 100000이상이어야 하고 CountryCode가 USA인 모든 컬럼을 찾으라는 문제이다.
SELECT ~ FROM ~ WHERE의 기본 구조를 사용해서 주어진 조건은 WHERE절에서 처리해주면 간단히 완료.
SELECT * FROM CITY WHERE POPULATION > 100000 AND COUNTRYCODE = 'USA'; |