Skip to content

Commit e2237d6

Browse files
committed
leetcode question
1 parent f460dbd commit e2237d6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ These are scripts that answer questions from <a href="https://leetcode.com">leet
1717
|[Department Top Three Salaries](https://leetcode.com/problems/department-top-three-salaries/submissions/) | [Solution](https://github.com/mdh266/SQL-Practice/blob/master/leetcode/Top3DeptSalaries.sql) |
1818
|[N-th Highest Salary](https://leetcode.com/problems/nth-highest-salary/) | [Solution](https://github.com/mdh266/SQL-Practice/blob/master/leetcode/NthHighestSalary.sql)|
1919
|[Department Highest Salary](https://leetcode.com/problems/department-highest-salary/) | [Solution](https://github.com/mdh266/SQL-Practice/blob/master/leetcode/DeptHighestSalary.sql) |
20+
| [Monthly Transactions I](https://leetcode.com/problems/monthly-transactions-i/) |
21+
[Solution](https://github.com/mdh266/SQL-Practice/blob/master/leetcode/monthly-transactions-i.sql) ||
2022
| [Rank Scores](https://leetcode.com/problems/rank-scores/) | [Solution](https://github.com/mdh266/SQL-Practice/blob/master/leetcode/RankScores.sql) |
2123
| [Not Boring Movies](https://leetcode.com/problems/not-boring-movies/) | [Solution](https://github.com/mdh266/SQL-Practice/blob/master/leetcode/notboringmovies.sql)|
2224
| [Exchange Seats](https://leetcode.com/problems/exchange-seats/) | [Solution](https://github.com/mdh266/SQL-Practice/blob/master/leetcode/exchange-seats.sql)|

leetcode/monthly-transactions-i.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
SELECT
2+
CAST(trans_date AS CHAR(7)) AS month,
3+
country,
4+
COUNT(1) AS trans_count,
5+
SUM(CASE WHEN state = 'approved' THEN 1 ELSE 0 END) approved_count,
6+
SUM(amount) AS trans_total_amount,
7+
SUM(CASE WHEN state = 'approved' THEN amount ELSE 0 END) approved_total_amount
8+
FROM
9+
Transactions
10+
GROUP BY 1,2
11+
;

0 commit comments

Comments
 (0)