Weather Observation Station 6 in SQL | HackerRank Solution

Hello coders, today we are going to solve Weather Observation Station 6 HackerRank Solution in SQL.

Weather Observation Station 6 in SQL

Problem

Query the list of CITY names starting with vowels (i.e., aeio, or u) from STATION. Your result cannot contain duplicates.

Input Format

The STATION table is described as follows:

FieldType
IDNUMBER
CITYVARCHAR2(21)
STATEVARCHAR2(2)
LAT_NNUMBER
LONG_WNUMBER

where LAT_N is the northern latitude and LONG_W is the western longitude.

Solution – Weather Observation Station 6 in SQL

SELECT DISTINCT city FROM station WHERE city LIKE "A%" OR city LIKE "E%" OR city LIKE "I%" OR city LIKE "O%" OR city LIKE "U%";

Disclaimer: The above Problem (Weather Observation Station 6) is generated by Hacker Rank but the Solution is Provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.

5 thoughts on “Weather Observation Station 6 in SQL | HackerRank Solution”

    1. Try the following

      SELECT DISTINCT(CITY)
      FROM STATION
      WHERE CITY LIKE ‘A%’ OR CITY LIKE ‘E%’ OR CITY LIKE ‘I%’ OR CITY LIKE ‘O%’ OR city LIKE ‘U%’;

  1. select distinct city from station WHERE city LIKE ‘A%’ OR city LIKE ‘E%’ OR city LIKE ‘I%’ OR city LIKE ‘O%’ OR city LIKE ‘U%’;

  2. Mehalan Frankco

    SELECT DISTINCT CITY
    FROM STATION
    WHERE LEFT(CITY,1) IN (‘A’,’E’,’I’,’O’,’U’);

Leave a Comment

Your email address will not be published. Required fields are marked *