본문 바로가기

Algorithm/MySQL

[해커랭크(HackerRank)] Select By ID (MySQL)

문제

Query all columns for a city in CITY with the ID 1661.

The CITY table is described as follows:

 

코드

SELECT * 
FROM CITY
WHERE ID = 1661

 

풀이

  1. CITY 테이블 전체 조회
  2. ID의 타입은 NUMBER이나 ID = '1661' 로 입력했을 경우에도 문자형이지만 자동으로 변환이 되어 같은 결과가 출력됨

 

 

Select By ID | HackerRank

Query the details of the city with ID 1661.

www.hackerrank.com

 

반응형