본문 바로가기
728x90
반응형

전체 글 보기164

HackerRank_14. 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 CITY FROM STATION WHERE SUBSTR(CITY, 1, 1) IN ('a', 'e', 'i', 'o', 'u') AND SUBSTR(CITY, -1, 1) IN ('a', 'e', 'i', 'o', 'u'); Upperco Aguanga East China East Irvine Amo Eleele Oconee Amazonia Aliso Viejo Anderso.. 2020. 6. 11.
HackerRank_13. Weather Observation Station 7 문제 : Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates. SUBSTR을 사용할 때 start의 위치를 -1로 지정해주었다. ( python의 list[-1] 느낌 ! ) SELECT distinct CITY FROM STATION WHERE SUBSTR(CITY, -1, 1) IN ('a', 'e', 'i', 'o', 'u'); Glencoe Chelsea Pelahatchie Dorrance Cahone Upperco Waipahu Millville Aguanga Morenci South El Monte Gustine Delano Westpha.. 2020. 6. 11.
HackerRank_12. Weather Observation Station 6 문제 : Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates. city의 첫번째 문자만 가져오기 위해서 SUBSTR 함수를 사용하자. SUBSTR(str, pos, len) 로 사용할 수 있다. MySQL : SUBSTR(), SUBSTRING() Oracle : SUBSTR() SQL Server : SUBSTRING() SELECT distinct CITY FROM STATION WHERE SUBSTR(CITY, 1, 1) IN ('a', 'e', 'i', 'o', 'u'); Arlington Albany Upperco Agua.. 2020. 6. 11.
HackerRank_11. 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. SELECT CITY, CHAR_LENGTH(CITY) FROM STATION ORDER BY CHAR_LENGTH(CITY) ASC, CITY ASC LIMIT 1; SELECT CITY, CHAR_LENGTH(CITY) FRO.. 2020. 6. 11.
HackerRank_10. Weather Observation Station 4 문제 : SELECT COUNT(*) - COUNT(distinct CITY) FROM STATION; 13 2020. 6. 11.
HackerRank_09. Weather Observation Station 3 문제 : Query a list of CITY names from STATION with even ID numbers only. You may print the results in any order, but must exclude duplicates from your answer. select distinct CITY from STATION where MOD(ID,2) = 0; 2020. 6. 11.
HackerRank_08. Weather Observation Station 2 문제 : Query the following two values from the STATION table: The sum of all values in LAT_N rounded to a scale of decimal places. The sum of all values in LONG_W rounded to a scale of decimal places. SELECT ROUND(SUM(LAT_N), 2) AS lat, ROUND(SUM(LONG_W),2) AS lon FROM STATION; 42850.04 47381.48 2020. 6. 11.
HackerRank_07.Weather Observation Station 1 문제 : Query a list of CITY and STATE from the STATION table. select CITY, STATE from STATION; 2020. 6. 11.
HackerRank_06. Japanese Cities' Names 문제 : Query the names of all the Japanese cities in the CITY table. The COUNTRYCODE for Japan is JPN. select NAME from CITY where COUNTRYCODE = 'JPN'; Neyagawa Ageo Sayama Omuta Tokuyama 2020. 6. 11.
HackerRank_05.Japanese Cities' Attributes 문제 : Query all attributes of every Japanese city in the CITY table. The COUNTRYCODE for Japan is JPN. select * from CITY where COUNTRYCODE = 'JPN'; 1613 Neyagawa JPN Osaka 257315 1630 Ageo JPN Saitama 209442 1661 Sayama JPN Saitama 162472 1681 Omuta JPN Fukuoka 142889 1739 Tokuyama JPN Yamaguchi 107078 2020. 6. 11.
728x90
반응형