
Problem
Query a list of CITY names from STATION with even ID numbers only. You may print the results in any order, but must exclude duplicates from your answer.
Input Format
The STATION table is described as follows:
| Field | Type |
|---|---|
| ID | NUMBER |
| CITY | VARCHAR2(21) |
| STATE | VARCHAR2(2) |
| LAT_N | NUMBER |
| LONG_W | NUMBER |
where LAT_N is the northern latitude and LONG_W is the western longitude.
Analysis
- query CITY names ==> SELECT CITY
- from STATION table ==> FROM STATION
- even ID numbers only ==> WHERE ID % 2 = 0
- exclude duplicates ==> SELECT DISTINCT CITY
Solution
|
|
Link
Weather Observation Station 3
(中文版) SQL 笔记: Hackerrank Weather Observation Station 3




近期评论