본문 바로가기

Algorithm30

[SQL] 프로그래머스 - 부서별 평균 연봉 조회하기 https://school.programmers.co.kr/learn/courses/30/lessons/284529 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 1. Problem 부서별로 부서 ID, 영문 부서명, 평균 연봉을 조회하는 SQL문을 작성해주세요. 평균연봉은 소수점 첫째 자리에서 반올림하고 컬럼명은 AVG_SAL로 해주세요. 결과는 부서별 평균 연봉을 기준으로 내림차순 정렬해주세요. 2. Analysis1. 부서 별 직원들의 연봉을 알기 위해서는 부서에 포함된 직원들을 먼저 알아야 하니 부서 테이블과 직원 테이블 2개를 조인함FROM HR_E.. 2024. 7. 13.
[SQL] 프로그래머스 - 물고기 종류 별 대어 찾기 https://school.programmers.co.kr/learn/courses/30/lessons/293261  1. Problem 물고기 종류 별로 가장 큰 물고기의 ID, 물고기 이름, 길이를 출력하는 SQL 문을 작성해주세요. 결과는 물고기의 ID에 대해 오름차순 정렬해주세요.2. Analysis1. 물고기 종류 별로 가장 큰 물고기를 구하기SELECT FISH_TYPE ,MAX(LENGTH) AS LENGTH_MAXFROM FISH_INFOGROUP BY FISH_TYPE2. 1번에서 구한 테이블과 FISH_INFO 테이블의 FISH_TYPE과 LENGTH의 값이 일치하는 조건을 주어 종류 별로 가장 큰 물고기 ID를 구할 수 있다. WHERE (F.FISH_TYPE, .. 2024. 7. 13.
Leetcode SQL 50 - 602. Friend Requests II: Who Has the Most Friends 문제 사이트: @leetcode Table: RequestAccepted +----------------+---------+ | Column Name | Type | +----------------+---------+ | requester_id | int | | accepter_id | int | | accept_date | date | +----------------+---------+ (requester_id, accepter_id) is the primary key (combination of columns with unique values) for this table. This table contains the ID of the user who sent the request, the ID of t.. 2024. 3. 23.
Leetcode SQL 50 - 1070. Product Sales Analysis III 문제 사이트: @leetcode Table: Sales +-------------+-------+ | Column Name | Type | +-------------+-------+ | sale_id | int | | product_id | int | | year | int | | quantity | int | | price | int | +-------------+-------+ (sale_id, year) is the primary key (combination of columns with unique values) of this table. product_id is a foreign key (reference column) to Product table. Each row of this table s.. 2024. 3. 23.