본문 바로가기

데이터 분석/SQL 연습문제45

Contest Leaderboard (HackerRank) Contest Leaderboard | HackerRank Generate the contest leaderboard. www.hackerrank.com Write a query to print the hacker_id, name, and total score of the hackers ordered by the descending score. If more than one hacker achieved the same total score, then sort the result by ascending hacker_id. Exclude all hackers with a total score of 0 from your result. 풀이 제출한 답 with sub as( select hacker_id, ch.. 2022. 10. 4.
Weather Observation Station 17 (HackerRank) Weather Observation Station 17 | HackerRank Query the Western Longitude for the smallest value of the Northern Latitudes greater than 38.7780 in STATION and round to 4 decimal places. www.hackerrank.com Query the Western Longitude (LONG_W) where the smallest Northern Latitude (LAT_N) in STATION is greater than 38.7780. Round your answer to 4 decimal places. 풀이 제출한 답 select round(LONG_W, 4) from .. 2022. 9. 29.
185. Department Top Three Salaries (LeetCode) Department Top Three Salaries - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com A high earner in a department is an employee who has a salary in the top three unique salaries for that department. Write an SQL query to find the employees who are high earners in each of the departmen.. 2022. 9. 26.
The Report (HackerRank) The Report | HackerRank Write a query to generate a report containing three columns: Name, Grade and Mark. www.hackerrank.com Ketty gives Eve a task to generate a report containing three columns: Name, Grade and Mark. Ketty doesn't want the NAMES of those students who received a grade lower than 8. The report must be in descending order by grade -- i.e. higher grades are entered first. If there .. 2022. 9. 20.
Challenges (HackerRank) Challenges | HackerRank Print the total number of challenges created by hackers. www.hackerrank.com Write a query to print the hacker_id, name, and the total number of challenges created by each student. Sort your results by the total number of challenges in descending order. If more than one student created the same number of challenges, then sort the result by hacker_id. If more than one stude.. 2022. 9. 19.
184. Department Highest Salary (LeetCode) Department Highest Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Write an SQL query to find employees who have the highest salary in each of the departments. 풀이 제출한 답 select d.name as department, e.name as employee, e.salary as salary from employee as e join department a.. 2022. 9. 18.
Top Earners (HackerRank) Top Earners | HackerRank Find the maximum amount of money earned by any employee, as well as the number of top earners (people who have earned this amount). www.hackerrank.com We define an employee's total earnings to be their monthly worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings fo.. 2022. 9. 17.
196. Delete Duplicate Emails (LeetCode) Delete Duplicate Emails - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Write an SQL query to delete all the duplicate emails, keeping only one unique email with the smallest id. Note that you are supposed to write a DELETE statement and not a SELECT one. 풀이 제출한 오답 delete from Pe.. 2022. 9. 16.
627. Swap Salary (LeetCode) Swap Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Write an SQL query to swap all 'f' and 'm' values (i.e., change all 'f' values to 'm' and vice versa) with a single update statement and no intermediate temporary tables. 풀이 제출한 답 UPDATE SALARY SET SEX = CASE WHEN SEX = .. 2022. 9. 15.
코테 연습 26일차 (프로그래머스 SQL 고득점 Kit) My SQL / sublime 코딩테스트 연습 - 오랜 기간 보호한 동물(2) ANIMAL_INS 테이블은 동물 보호소에 들어온 동물의 정보를 담은 테이블입니다. ANIMAL_INS 테이블 구조는 다음과 같으며, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE는 각각 동물의 아이디 programmers.co.kr 입양을 간 동물 중, 보호 기간이 가장 길었던 동물 두 마리의 아이디와 이름을 조회하는 SQL문을 작성해주세요. 이때 결과는 보호 기간이 긴 순으로 조회해야 합니다. 풀이 제출한 오답 1 -- 코드를 입력하세요 SELECT B.ANIMAL_ID, B.NAME, DATE(B.DATETIME) - DATE(A.DAT.. 2022. 3. 9.