Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1946da0

Browse files
feat: update sql solution to lc problems: No.1435, No.2205 (doocs#1825)
1 parent 4ebb1b6 commit 1946da0

File tree

6 files changed

+16
-22
lines changed

6 files changed

+16
-22
lines changed

‎solution/1400-1499/1435.Create a Session Bar Chart/README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ Sessions 表:
7070
### **SQL**
7171

7272
```sql
73-
SELECT '[0-5>' AS bin, count(1) AS total FROM Sessions WHERE duration < 300
73+
SELECT '[0-5>' AS bin, COUNT(1) AS total FROM Sessions WHERE duration < 300
7474
UNION
75-
SELECT '[5-10>' AS bin, count(1) AS total FROM Sessions WHERE 300 <= duration AND duration < 600
75+
SELECT '[5-10>' AS bin, COUNT(1) AS total FROM Sessions WHERE 300 <= duration AND duration < 600
7676
UNION
77-
SELECT '[10-15>' AS bin, count(1) AS total FROM Sessions WHERE 600 <= duration AND duration < 900
77+
SELECT '[10-15>' AS bin, COUNT(1) AS total FROM Sessions WHERE 600 <= duration AND duration < 900
7878
UNION
79-
SELECT '15 or more' AS bin, count(1) AS total FROM Sessions WHERE 900 <= duration;
79+
SELECT '15 or more' AS bin, COUNT(1) AS total FROM Sessions WHERE 900 <= duration;
8080
```
8181

8282
<!-- tabs:end -->

‎solution/1400-1499/1435.Create a Session Bar Chart/README_EN.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ For session_id 5 has a duration greater than or equal to 15 minutes.
6565
### **SQL**
6666

6767
```sql
68-
SELECT '[0-5>' AS bin, count(1) AS total FROM Sessions WHERE duration < 300
68+
SELECT '[0-5>' AS bin, COUNT(1) AS total FROM Sessions WHERE duration < 300
6969
UNION
70-
SELECT '[5-10>' AS bin, count(1) AS total FROM Sessions WHERE 300 <= duration AND duration < 600
70+
SELECT '[5-10>' AS bin, COUNT(1) AS total FROM Sessions WHERE 300 <= duration AND duration < 600
7171
UNION
72-
SELECT '[10-15>' AS bin, count(1) AS total FROM Sessions WHERE 600 <= duration AND duration < 900
72+
SELECT '[10-15>' AS bin, COUNT(1) AS total FROM Sessions WHERE 600 <= duration AND duration < 900
7373
UNION
74-
SELECT '15 or more' AS bin, count(1) AS total FROM Sessions WHERE 900 <= duration;
74+
SELECT '15 or more' AS bin, COUNT(1) AS total FROM Sessions WHERE 900 <= duration;
7575
```
7676

7777
<!-- tabs:end -->
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
SELECT '[0-5>' AS bin, count(1) AS total FROM Sessions WHERE duration < 300
1+
SELECT '[0-5>' AS bin, COUNT(1) AS total FROM Sessions WHERE duration < 300
22
UNION
3-
SELECT '[5-10>' AS bin, count(1) AS total FROM Sessions WHERE 300 <= duration AND duration < 600
3+
SELECT '[5-10>' AS bin, COUNT(1) AS total FROM Sessions WHERE 300 <= duration AND duration < 600
44
UNION
5-
SELECT '[10-15>' AS bin, count(1) AS total FROM Sessions WHERE 600 <= duration AND duration < 900
5+
SELECT '[10-15>' AS bin, COUNT(1) AS total FROM Sessions WHERE 600 <= duration AND duration < 900
66
UNION
7-
SELECT '15 or more' AS bin, count(1) AS total FROM Sessions WHERE 900 <= duration;
7+
SELECT '15 or more' AS bin, COUNT(1) AS total FROM Sessions WHERE 900 <= duration;

‎solution/2200-2299/2205.The Number of Users That Are Eligible for Discount/README.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,9 @@ startDate = 2022年03月08日, endDate = 2022年03月20日, minAmount = 1000
7474
CREATE FUNCTION getUserIDs(startDate DATE, endDate DATE, minAmount INT) RETURNS INT
7575
BEGIN
7676
RETURN (
77-
# Write your MySQL query statement below.
78-
# Write your MySQL query statement below.
7977
SELECT COUNT(DISTINCT user_id) AS user_cnt
8078
FROM Purchases
81-
WHERE time_stamp BETWEEN startDate AND endDate AND amount >= minAmount;
79+
WHERE time_stamp BETWEEN startDate AND endDate AND amount >= minAmount
8280
);
8381
END
8482
```

‎solution/2200-2299/2205.The Number of Users That Are Eligible for Discount/README_EN.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,9 @@ Out of the three users, only User 3 is eligible for a discount.
6464
CREATE FUNCTION getUserIDs(startDate DATE, endDate DATE, minAmount INT) RETURNS INT
6565
BEGIN
6666
RETURN (
67-
# Write your MySQL query statement below.
68-
# Write your MySQL query statement below.
6967
SELECT COUNT(DISTINCT user_id) AS user_cnt
7068
FROM Purchases
71-
WHERE time_stamp BETWEEN startDate AND endDate AND amount >= minAmount;
69+
WHERE time_stamp BETWEEN startDate AND endDate AND amount >= minAmount
7270
);
7371
END
7472
```
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
CREATE FUNCTION getUserIDs(startDate DATE, endDate DATE, minAmount INT) RETURNS INT
22
BEGIN
33
RETURN (
4-
# Write your MySQL query statement below.
5-
# Write your MySQL query statement below.
64
SELECT COUNT(DISTINCT user_id) AS user_cnt
75
FROM Purchases
8-
WHERE time_stamp BETWEEN startDate AND endDate AND amount >= minAmount;
6+
WHERE time_stamp BETWEEN startDate AND endDate AND amount >= minAmount
97
);
10-
END
8+
END

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /