❓ Question https://www.hackerrank.com/challenges/weather-observation-station-12 Weather Observation Station 12 | HackerRank Query an alphabetically ordered list of CITY names not starting and ending with vowels. www.hackerrank.com ❗ Answer 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')); 📌 Discussion - WHERE절에서..
❓ Question https://www.hackerrank.com/challenges/weather-observation-station-11 Weather Observation Station 11 | HackerRank Query a list of CITY names not starting or ending with vowels. www.hackerrank.com ❗ Answer SELECT DISTINCT(city) FROM station WHERE (LEFT(city,1) NOT IN ('a','e','i','o','u')) OR (RIGHT(city,1) NOT IN ('a','e','i','o','u')); 📌 Discussion - WHERE에 OR로 합집합 조건을 걸어줌
❓ Question https://www.hackerrank.com/challenges/weather-observation-station-10 Weather Observation Station 10 | HackerRank Query a list of CITY names not ending in vowels. www.hackerrank.com ❗ Answer SELECT DISTINCT(city) FROM station WHERE RIGHT(city,1) NOT IN ('a','e','i','o','u'); 📌 Discussion - WHERE NOT IN으로 조건문에 포함되지 않는 레코드 추출
❓ Question https://www.hackerrank.com/challenges/weather-observation-station-9 Weather Observation Station 9 | HackerRank Query an alphabetically ordered list of CITY names not starting with vowels. www.hackerrank.com ❗ Answer SELECT DISTINCT(city) FROM station WHERE LEFT(city,1) NOT IN ('a','e','i','o','u') 📌 Discussion - WHERE NOT IN 으로 포함되지 않는 조건을 걸어줌
❓ Question https://www.hackerrank.com/challenges/weather-observation-station-8 Weather Observation Station 8 | HackerRank Query CITY names that start AND end with vowels. www.hackerrank.com ❗ Answer SELECT DISTINCT(city) FROM station WHERE (LEFT(city,1) IN ('a','e','i','o','u')) AND (RIGHT(city,1) IN ('a','e','i','o','u')); 📌 Discussion - WHERE 절에서 LEFT와 RIGHT 조건을 AND로 동시 만족 시키는 레코드만 추출
❓ Question https://www.hackerrank.com/challenges/weather-observation-station-7 Weather Observation Station 7 | HackerRank Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. www.hackerrank.com ❗ Answer SELECT DISTINCT(city) FROM station WHERE RIGHT(city,1) IN ('a','e','i','o','u'); 📌 Discussion - RIGHT(column,n)은 column의 data에서 오른쪽 끝부터 n번째까지 추출하는 함수
❓ Question https://www.hackerrank.com/challenges/weather-observation-station-6 Weather Observation Station 6 | HackerRank Query a list of CITY names beginning with vowels (a, e, i, o, u). www.hackerrank.com ❗ Answer SELECT DISTINCT(city) FROM station WHERE LEFT(city,1) IN ('a','e','i','o','u'); 📌 Discussion - LEFT(column,num)으로 왼쪽부터 num번째까지의 데이터를 추출 - a IN b 으로 b안에 a가 있는 레코드만 추출
❓ Question https://www.hackerrank.com/challenges/weather-observation-station-4 Weather Observation Station 4 | HackerRank Find the number of duplicate CITY names in STATION. www.hackerrank.com ❗ Answer SELECT COUNT(city)-COUNT(DISTINCT city) FROM station; 📌 Discussion - COUNT로 레코드의 개수를 집계