본문 바로가기
728x90

Be Smart/SQL55

[Oracle] HackerRank 문제 정리 - 5 Interviews 테이블: Contests: Colleges: Challenges: View_Stats: Submission_Stats: Sample Input: Sample Output: 66406 17973 Rose 111 39 156 56 66556 79153 Angela 0 0 11 10 94828 80275 Frank 150 38 41 15 조건: Samantha는 코딩 챌린지 및 콘테스트를 사용하여 여러 대학의 많은 후보자를 인터뷰합니다. 콘테스트_id , 해커_id , 이름 및 콘테스트 _id 로 정렬된 각 콘테스트에 대한 total_submissions , total_accepted_submissions , total_views 및 total_unique_views 의 합계 를 인쇄하는 .. 2022. 8. 4.
[Oracle] HackerRank 문제 정리 - 3 Contest Leaderboard 테이블: Hackers Submissions 조건: 작업 의 End_Date 가 연속적이면 동일한 프로젝트의 일부입니다. Samantha는 완료된 서로 다른 프로젝트의 총 수를 찾는 데 관심이 있습니다. 프로젝트를 완료하는 데 걸린 일 수로 나열된 프로젝트의 시작 날짜와 종료 날짜를 오름차순으로 출력하는 쿼리를 작성하십시오. 완료 일수가 동일한 프로젝트가 두 개 이상 있는 경우 프로젝트 시작 날짜를 기준으로 주문하십시오. select min(start_date), max(end_date) from (select start_date ,end_date ,start_date-row_number()over(order by start_date) as rnk from Projec.. 2022. 8. 2.
[Oracle] HackerRank 문제 정리 - 1 문제 개요 Hackers 테이블 Challenges 테이블 해커 ID , 이름 및 각 학생이 생성한 총 챌린지 수 를 출력하는 쿼리를 작성하십시오 . 총 챌린지 수를 기준으로 결과를 내림차순으로 정렬합니다. 두 명 이상의 학생이 같은 수의 도전 과제를 만든 경우 해커 ID를 기준으로 결과를 정렬 합니다 . 두 명 이상의 학생이 동일한 수의 도전 과제를 생성하고 개수가 생성된 최대 과제 수보다 적은 경우 해당 학생을 결과에서 제외합니다. WITH data AS ( SELECT c.hacker_id as id, h.name as name, count(c.hacker_id) as cnt FROM Hackers h JOIN Challenges c on c.hacker_id = h.hacker_id GROUP B.. 2022. 8. 1.
[Oracle] HackerLank-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. The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. Sample Input For.. 2022. 7. 27.
728x90