일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- One-Sided Selection
- 병리 AI
- Grad-CAM
- Process Mining
- Data Imbalance
- 국비지원교육
- Tomek links
- OCSVM
- Text generation
- PM4Py
- Digital Pathology
- 거리 기반 이상탐지
- 프로세스 마이닝
- SQL 데이터 분석 첫걸음
- Inatance segmentation
- Meta heuristic
- Random Undersampling
- 딥러닝
- Condensed neares neighbor rule
- Fixed Learning
- multi modal
- GAN
- XAI
- 밀도 기반 이상탐지
- Gausian Density Estimation
- Sequence data
- Generative modeling
- Clustering 기반 이상탐지
- Petri net
- auto encoder
- Today
- Total
Create Opportunities
[Hacker Rank] 231206 본문
# 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.
select distinct A.city
from station A
where mod(A.id, 2) = 0
;
# Weather Observation Station 5
Query the two cities in STATION with the shortest and longest CITY names, as well as their respective lengths (i.e.: number of characters in the name). If there is more than one smallest or largest city, choose the one that comes first when ordered alphabetically.
When ordered alphabetically, the CITY names are listed as ABC, DEF, PQRS, and WXY, with lengths and . The longest name is PQRS, but there are options for shortest named city. Choose ABC, because it comes first alphabetically.
SELECT city, LENGTH(city)
FROM station
WHERE LENGTH(city) = (
SELECT MIN(LENGTH(city))
FROM station
)
ORDER BY city
LIMIT 1;
SELECT city, LENGTH(city)
FROM station
WHERE LENGTH(city) = (
SELECT MAX(LENGTH(city))
FROM station
)
ORDER BY city
LIMIT 1;
# Weather Observation Station 8
Query the list of CITY names from STATION which have vowels (i.e., a, e, i, o, and u) as both their first and last characters. Your result cannot contain duplicates.
select distinct A.city
from station A
where substring(city, 1, 1) in ('a', 'e', 'i', 'o', 'u')
and right(city, 1) in ('a', 'e', 'i', 'o', 'u')
;
REGEXP_LIKE : LIKE를 이용한 검색과 달리 Regular Expression(정규 표현식)을 이용해 검색할 수 있다. 복잡한 문자열 조건을 걸어서 데이터를 검색한다.
select distinct city
from station
where regexp_like(city, '^[aeiou]')
and regexp_like(city, '[aeiou]$')
;
'SQL' 카테고리의 다른 글
[패스트 캠퍼스] SQL 기초 강의 (2주차) (0) | 2023.03.21 |
---|---|
[패스트 캠퍼스] SQL 기초 강의 (1주차) (1) | 2023.03.15 |