[HackerRank MySQL] SELECT, WHERE 문제풀기 (Basic)
2021. 1. 5. 19:15ㆍToday I Learned.../MySQL
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.
The CITY table is described as follows:
select *
from city
where population > 100000 and countrycode = 'usa'
Revising the Select Query II
Query the NAME field for all American cities in the CITY table with populations larger than 120000. The CountryCode for America is USA.
select name
from city
where population > 120000 and countrycode = 'usa'
Select All
Query all columns (attributes) for every row in the CITY table.
select *
from city
Select By ID
Query all columns for a city in CITY with the ID 1661.
select *
from city
where id = 1661
Japanese Cities' Attributes
Query all attributes of every Japanese city in the CITY table. The COUNTRYCODE for Japan is JPN.
select *
from city
where countrycode = 'jpn'
Japanese Cities' Names
Query the names of all the Japanese cities in the CITY table. The COUNTRYCODE for Japan is JPN.
select name
from city
where countrycode = 'jpn'
문제 출처: 해커랭크
'Today I Learned... > MySQL' 카테고리의 다른 글
[HackerRank MySQL] ORDER BY 문제풀기 (Basic) (0) | 2021.01.05 |
---|---|
[HackerRank MySQL] Weather Observation Station 1, 3-12 + REGEXP (Basic) & MOD() Function (0) | 2021.01.05 |
[프로그래머스 SQL 고득점 Kit] String, Date 문제풀기 (0) | 2020.12.29 |
[프로그래머스 SQL 고득점 Kit] JOIN 문제풀기 (0) | 2020.12.29 |
[프로그래머스 SQL 고득점 Kit] IS NULL 문제풀기 (0) | 2020.12.28 |