반응형 weather observation station10 [MySQL] Weather Observation Station 5 ▶ SQL > Basic Select > Weather Observation Station 5 Problem 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. The STATION table is described as follows: > STATION에서 가장 짧고 긴 CITY 이름과 .. 2021. 3. 31. [MySQL] Weather Observation Station 4 ▶ SQL > Basic Select > Weather Observation Station 4 Problem Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table. The STATION table is described as follows: > 표에 있는 총 CITY 항목 수와 표에 있는 고유 CITY 항목 수의 차이를 구하라. My Answer SELECT COUNT(CITY) - COUNT(DISTINCT(CITY)) FROM STATION NOTE *집계함수 COUNT : 행 개수 구하기 SELECT COUNT(열1), COUN.. 2021. 3. 31. [MySQL] Weather Observation Station 3 ▶ SQL > Basic Select > Weather Observation Station 3 Problem 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. → 중복X The STATION table is described as follows: My Answer SELECT DISTINCT CITY FROM STATION WHERE ID % 2 = 0 NOTE DISTINCT : unique한 컬럼이나 튜플을 조회하는 경우 사용 정렬하지 않고 결과를 가져옴 GROUP BY에 비해 성능.. 2021. 3. 30. [MySQL] Weather Observation Station 1 ▶ SQL > Basic Select > Weather Observation Station 1 Problem Query a list of CITY and STATE from the STATION table. The STATION table is described as follows: My Answer SELECT CITY, STATE FROM STATION 2021. 3. 30. 이전 1 2 다음 반응형