Skip to content

Commit f911a76

Browse files
committed
Upload 114
1 parent 85cfa08 commit f911a76

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ To make the daily tasks of creating a new file and updating the index easier, th
142142
| 111 | [Project Employees I](https://leetcode.com/problems/project-employees-i/description/) | [Solution](solutions/111_project_employees_i.md) | LeetCode | Easy | |
143143
| 112 | [Percentage of Users Attended a Contest](https://leetcode.com/problems/percentage-of-users-attended-a-contest/description/) | [Solution](solutions/112_percentage_of_users_attended_a_contest.md) | LeetCode | Easy | |
144144
| 113 | [Queries Quality and Percentage](https://leetcode.com/problems/queries-quality-and-percentage/description/) | [Solution](solutions/113_queries_quality_and_percentage.md) | LeetCode | Easy | |
145+
| 114 | [Monthly Transactions I](https://leetcode.com/problems/monthly-transactions-i/description/) | [Solution](solutions/114_monthly_transactions_i.md) | LeetCode | Medium | |
145146

146147
## Author(s)
147148

@@ -154,4 +155,3 @@ To make the daily tasks of creating a new file and updating the index easier, th
154155
## Frontispiece
155156

156157
Plate LXI: 'This proud one / Would of his strength against almighty Jove / Make trial' (Cary). Canto xxxi: Line 82: Page 165. Image taken from Dante Alighieri, Dante's Inferno. Translated by Henry Francis Cary. Illustrated by Gustave Doré. New York, London, and Paris: Cassell & Company Limited, 1866.
157-
| 109 | [Not Boring Movies](https://leetcode.com/problems/not-boring-movies/description/) | [Solution](solutions/109_not_boring_movies.md) | LeetCode | Easy | |
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SQL Everyday \#114
2+
3+
## Monthly Transactions I
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Medium
7+
8+
## Problem
9+
10+
Write an SQL query to find for each month and country, the number of transactions and their total amount, the number of approved transactions and their total amount.
11+
12+
Return the result table in *any order*. [[Full Description](https://leetcode.com/problems/monthly-transactions-i/description/)]
13+
14+
## Submitted Solution
15+
16+
```sql
17+
-- Submitted Solution
18+
SELECT
19+
DATE_FORMAT(trans_date, '%Y-%m') AS month
20+
,country
21+
,COUNT(trans_date) AS trans_count
22+
,SUM(IF(state = 'approved', 1, 0)) AS approved_count
23+
,SUM(amount) AS trans_total_amount
24+
,SUM(IF(state = 'approved', amount, 0)) AS approved_total_amount
25+
FROM Transactions
26+
GROUP BY month, country
27+
;
28+
```
29+
30+
## Site Solution
31+
32+
```sql
33+
-- LeetCode Solution
34+
-- None provided
35+
```
36+
37+
## Notes
38+
39+
TODO
40+
41+
Go to [Table of Contents](/README.md#contents)\
42+
Go to [Overview](/README.md)

0 commit comments

Comments
 (0)