안녕하세요!
이번 포스팅은 LeetCode에 있는 Bank Account Summary II 문제를 OracleDB로 풀어보려고 합니다!
(모든 문제는 Oracle로 풀이하겠습니다.)
1. 문제 링크 : https://leetcode.com/problems/bank-account-summary-ii/description/
2. 문제
| Column name | Type |
| account | int |
| name | varchar |
| Column name | Type |
| trans_id | int |
| account | int |
| amount | int |
| transacted_on | date |
[문제] Write a solution to report the name and balance of users with a balance higher than 10000. The balance of an account is equal to the sum of the amounts of all transactions involving that account.
잔액이 10000 이상인 사용자의 이름과 잔액을 조회하는 문제입니다.
3. 제출 쿼리 및 설명
최종) 잔액이 10000 이상인 사용자의 이름과 잔액을 조회합니다.
SELECT U.NAME, SUM(AMOUNT) AS BALANCE
FROM USERS U, TRANSACTIONS T
WHERE U.ACCOUNT = T.ACCOUNT
GROUP BY U.NAME
HAVING SUM(AMOUNT) > 10000
;
4. 풀이 과정 중 알아야 할 것들!
'SQL > LeetCode' 카테고리의 다른 글
| [SQL] Average Time of Process per Machine(LeetCode/Oracle) (0) | 2023.10.26 |
|---|---|
| [SQL] Percentage of Users Attended a Contest(LeetCode/Oracle) (0) | 2023.10.26 |
| [SQL] Patients With a Condition(LeetCode/Oracle) (0) | 2023.10.26 |
| [SQL] Group Sold Products By The Date(LeetCode/Oracle) (0) | 2023.10.26 |
| [SQL] Top Travellers(LeetCode/Oracle) (1) | 2023.10.26 |