프로그래밍 언어/SQL14 [HACKERRANK] AVERAGE POPULATION https://www.hackerrank.com/challenges/average-population/problem?isFullScreen=true Average Population | HackerRank Query the average population of all cities, rounded down to the nearest integer. www.hackerrank.com 상당히 쉬운 문젠데 자꾸 비슷한 함수끼리 헷갈려서 정리해본다. 인구 평균을 버림해서 정수로 값을 도출해라. SELECT FLOOR(AVG(POPULATION)) FROM CITY > ROUND (값, 반올림해서 남길 자리 수) - 반올림할 때 사용하는 함수 - 값 뒤에 나오는 숫자는 .. 2022. 1. 24. [MySQL] 한 행 안에 있는 문자열 여러 개를 행으로 분리하기 이렇게 생긴 테이블을 이렇게 바꾸는 방법!! 우선 모범 답안을 보고 코드를 뜯어보자. select tb.drama, substring_index(substring_index(tb.names, "$", numbers.n), "$" , -1) as name from ( select 1 as n union all select 2 union all select 3 union all select 4 union all select 5) as numbers inner join tb on char_length(tb.names) - char_length(replace(tb.names, "$", "")) >= numbers.n - 1 order by tb.drama 어떻게 문자열을 쪼갤까? drama names 구경이 이.. 2022. 1. 14. [Hackerrank] Weather Observation Station 5 자세한 문항은 아래 링크에서 확인하실 수 있습니다. https://www.hackerrank.com/challenges/weather-observation-station-5/problem?isFullScreen=true&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen Weather Observation Station 5 | HackerRank Write a query to.. 2022. 1. 13. [Hackerrank] Print Prime Numbers 풀이 (MySQL) 해당 문제는 아래 링크에서 더 자세히 참고하실 수 있습니다. https://www.hackerrank.com/challenges/print-prime-numbers/problem?h_r=internal-search Print Prime Numbers | HackerRank Print prime numbers. www.hackerrank.com 문제 : 1000이하의 소수를 모두 출력해라. 조건 : 1. 여러 행에 걸쳐 모든 수를 출력하는 것이 아닌, 한 행에 모든 수를 & 구분자로 출력할 것 예상 답안 : 2&3&5&7 (10이하의 소수점을 출력했을 때) 테이블이 없는데..어떻게 풀지? 문제를 풀기 앞서, 가장 황당한 점은 나에게 주어진 테이블이 아무 것도 없다는 것이었다. 이런 경우 모든 데이터베이스에.. 2022. 1. 13. 이전 1 2 3 4 다음