Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 코딩테스트연습
- 프로그래머스
- 데이터분석
- SKU Consolidation
- MySQL
- ModelCheckPoint
- Product Demand
- eda
- 웨어하우스 보관 최적화
- forecast
- TensorFlowGPU
- ProfileReport
- leetcode
- 당신의 인생이 왜 힘들지 않아야 한다고 생각하십니까
- 피그마인디언
- Labor Management System
- 코딩테스트
- HackerRank
- 신경쓰기의 기술
- oracle
- tensorflow
- 파이썬
- SQL
- pandas profiling
- MS SQL Server
- ABC Analysis
- Inventory Optimization
- Gaimification
- kaggle
- 딥러닝
Archives
- Today
- Total
오늘도 배운다
585. Investments in 2016 / LeetCode, SQL, MySQL 본문
문제
source: LeetCode
Write an SQL query to report the sum of all total investment values in 2016 tiv_2016, for all policyholders who:
- have the same tiv_2015 value as one or more other policyholders, and
- are not located in the same city like any other policyholder (i.e., the (lat, lon) attribute pairs must be unique).
Round tiv_2016 to two decimal places.
The query result format is in the following example.
제출답안(MySQL)
SELECT
ROUND(SUM(tiv_2016), 2) AS tiv_2016
FROM
insurance
WHERE
tiv_2015 IN (SELECT tiv_2015
FROM insurance
GROUP BY tiv_2015
HAVING COUNT(pid) > 1)
AND (lat, lon) IN (SELECT lat, lon
FROM insurance
GROUP BY lat, lon
HAVING COUNT(pid) = 1)
문제 바로가기(MySQL)
728x90
'코딩테스트연습(SQL)' 카테고리의 다른 글
1193. Monthly Transactions I / LeetCode, SQL, MS SQL Server (0) | 2023.04.10 |
---|---|
1070. Product Sales Analysis III / LeetCode, SQL, MySQL (0) | 2023.04.10 |
570. Managers with at Least 5 Direct Reports / LeetCode, SQL, MS SQL Server (0) | 2023.04.04 |
대여 횟수가 많은 자동차들의 월별 대여 횟수 구하기 / 프로그래머스, SQL, MySQL (0) | 2023.04.02 |
특정 기간동안 대여 가능한 자동차들의 대여비용 구하기 / 프로그래머스, SQL, MySQL (0) | 2023.03.28 |
Comments