Skip to content

Commit a79914e

Browse files
add 1435
1 parent bb2c5dc commit a79914e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ _If you like this project, please leave me a star._ ★
10931093
|1517|[Find Users With Valid E-Mails](https://leetcode.com/problems/find-users-with-valid-e-mails/)|[Solution](../master/database/_1517.sql) || Easy |
10941094
|1511|[Customer Order Frequency](https://leetcode.com/problems/customer-order-frequency/)|[Solution](../master/database/_1511.sql) || Easy |
10951095
|1495|[Friendly Movies Streamed Last Month](https://leetcode.com/problems/friendly-movies-streamed-last-month/)|[Solution](../master/database/_1495.sql) || Easy |
1096+
|1435|[Create a Session Bar Chart](https://leetcode.com/problems/create-a-session-bar-chart/)|[Solution](../master/database/_1435.sql) || Easy |
10961097
|1484|[Group Sold Products By The Date](https://leetcode.com/problems/group-sold-products-by-the-date/)|[Solution](../master/database/_1484.sql) || Easy |
10971098
|1407|[Top Travellers](https://leetcode.com/problems/top-travellers/)|[Solution](../master/database/_1407.sql) || Easy |
10981099
|1384|[Total Sales Amount by Year](https://leetcode.com/problems/total-sales-amount-by-year/)|[Solution](../master/database/_1384.sql) || Hard |

database/_1435.sql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- # Write your MySQL query statement below
2+
with groupedBy as (
3+
select "[0-5>" as bin, 0 as minDuration, 60*5 as maxDuration
4+
union all
5+
select "[5-10>" as bin, 60*5 as minDuration, 60*10 as maxDuration
6+
union all
7+
select "[10-15>" as bin, 60*10 as minDuration, 60*15 as maxDuration
8+
union all
9+
select "15 or more" as bin, 60*15 as minDuration, 2147483647 as maxDuration
10+
)
11+
12+
select bin, count(session_id) as total from groupedBy
13+
left join Sessions on duration >= minDuration and duration < maxDuration
14+
group by bin;

0 commit comments

Comments
 (0)