본문 바로가기
코딩테스트/해커랭크

[해커랭크/Easy] Basic Select - Japanese Cities' Attributes (SQL)

by 달구우우우우 2023. 12. 11.
반응형

🔎 문제 링크

https://www.hackerrank.com/challenges/japanese-cities-attributes/problem?isFullScreen=true

 

Japanese Cities' Attributes | HackerRank

Query the attributes of all the cities in Japan.

www.hackerrank.com

 

✏️ 문제 설명

Query all attributes of every Japanese city in the CITY table. The COUNTRYCODE for Japan is JPN.
The CITY table is described as follows.

CITY 테이블에 있는 모든 일본 도시의 모든 속성을 쿼리합니다. 일본의 국가 코드는 JPN입니다.
CITY 테이블은 다음과 같이 설명됩니다.

 

 

🔦 문제 풀이

모든 열을 쿼리하기 위해선 SELECT * 구문을 활용하며, COUNTRYCODE(국가 코드)가 JPN인 경우를 필터하기 위해선 WHERE절을 사용하면 됩니다.

 

SELECT *
FROM CITY
WHERE COUNTRYCODE = 'JPN'

 

해당 SQL 문법은 MySQL을 사용했습니다.

반응형