
Problem
Query all columns for all American cities in CITY with populations larger than 100000. The CountryCode for America is USA.
Input Format
The CITY table is described as follows:
| Field | Type |
|---|---|
| ID | NUMBER |
| NAME | VARCHAR2(17) |
| COUNTRYCODE | VARCHAR2(3) |
| DISTRICT | VARCHAR2(20) |
| POPULATION | NUMBER |
Analysis
- query all columns ==> SELECT *
- in CITY table ==> FROM CITY
- populations larger than 100000 ==> POPULATION > 100000
- CountryCode for America is USA ==> COUNTRYCODE = ‘USA’
- American cities with populations larger than 100000 ==>
WHERE COUNTRYCODE = ‘USA’ AND POPULATION > 100000
Solution
|
|
Link
Revising the Select Query 1
(中文版) SQL 笔记: Hackerrank Revising the Select Query 1




近期评论