728x90
< Problem >
CITY 테이블에서 인구가 120000을 넘고, CountryCode가 USA인 칼럼의 NAME 가져오기
링크: https://www.hackerrank.com/challenges/revising-the-select-query-2/problem
Revising the Select Query II | HackerRank
Query the city names for all American cities with populations larger than 120,000.
www.hackerrank.com
< Code >
SELECT name
FROM city
WHERE population > 120000 AND countrycode ='USA'
< Lesson & Learned >
SELECT 문 (조건검색)
SELECT: 키워드와 함께 검색하고 싶은 속성의 이름을 나열
FROM: 키워드와 함께 검색하고 싶은 속성이 있는 데이블의 이름을 나열
WHERE: 키워드와 함께 비교 연산자(=, <, >=, <>)와 논리 연산자(AND, OR, NOT)를 이용한 검색 조건 제시
728x90
'SQL > [HackerRank]' 카테고리의 다른 글
[HackerRank/MySQL] Japanese Cities' Names (0) | 2023.03.04 |
---|---|
[HackerRank/MySQL] Japanese Cities' Attributes (0) | 2023.03.04 |
[HackerRank/MySQL] Select By ID (0) | 2023.03.04 |
[HackerRank/MySQL] Select All (0) | 2023.03.04 |
[HackerRank/MySQL] Revising the Select Query I (0) | 2023.03.04 |