> For the complete documentation index, see [llms.txt](https://pavithrasundaram091097s-organiza.gitbook.io/my-space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pavithrasundaram091097s-organiza.gitbook.io/my-space/skills/hackerrank/weather-observation-station-3.md).

# Weather Observation Station 3

Query a list of **CITY** names from **STATION** for cities that have an even **ID** number. Print the results in any order, but exclude duplicates from the answer.

{% embed url="<https://www.hackerrank.com/challenges/weather-observation-station-3/problem?isFullScreen=true>" %}

The **STATION** table is described as follows:

![](https://s3.amazonaws.com/hr-challenge-images/9336/1449345840-5f0a551030-Station.jpg)

where **LAT\_N** is the northern latitude and **LONG\_W** is the western longitude.

Sol:

SELECT DISTINCT CITY FROM STATION WHERE MOD(ID, 2) = 0;

Explanation:

* SELECT DISTINCT CITY : This part of the query indicates that we want to retrieve unique values from the CITY column of the STATION table. The DISTINCT keyword ensures that only distinct (unique) values are returned.
* FROM STATION: This specifies the table from which we want to retrieve the data, which is the STATION table.
* WHERE MOD(ID, 2) = 0: This is a condition added to the query using the WHERE clause.&#x20;
* The MOD function calculates the remainder of the ID divided by 2. If the remainder is 0, it means the ID is an even number. So, this condition filters the rows in the STATION table so that only rows with even IDs are included in the result.
