융무의 기술블로그
article thumbnail

https://www.hackerrank.com/challenges/weather-observation-station-12/problem?h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen

 

Weather Observation Station 12 | HackerRank

Query an alphabetically ordered list of CITY names not starting and ending with vowels.

www.hackerrank.com

Query the list of CITY names from STATION that do not start with vowels and do not end with vowels. Your result cannot contain duplicates.

Input Format

The STATION table is described as follows:

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

 

  • query CITY names ==> SELECT CITY
  • from STATION table ==> FROM STATION
  • do not start and end with vowels ==> WHERE CITY REGEXP ‘^[^aeiou].*[^aeiou]$’
  • do not contain duplicates ==> SELECT DISTINCT CITY
select distinct city 
from station
where (left(city,1) not in ('a','e','i','o','u')
and 
right(city,1) not in ('a','e','i','o','u'));
SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '^[^aeiou].*[^aeiou]$';

SELECT * FROM TEST WHERE regexp_like(text, '[a-z][0-9]'); 

[a-z], [0-9]는 소문자 전체와 0부터9까지의 숫자를 나타냅니다.




profile

융무의 기술블로그

@융무

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!