Skip to content

Commit b1d1f12

Browse files
committed
consecutive numbser
1 parent c058a07 commit b1d1f12

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- Write your MySQL/PostgreSQL query statement below
2+
SELECT DISTINCT l1.num as ConsecutiveNums
3+
FROM Logs l1
4+
JOIN Logs l2 ON l1.num = l2.num and l1.id = l2.id + 1
5+
JOIN Logs l3 ON l2.num = l3.num and l2.id = l3.id + 1;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
SELECT "Low Salary" AS category,
2+
sum(income < 20000) AS accounts_count
3+
FROM Accounts
4+
5+
UNION
6+
7+
SELECT "Average Salary" AS category,
8+
sum(income BETWEEN 20000 AND 50000) AS accounts_count
9+
FROM Accounts
10+
11+
UNION
12+
13+
SELECT "High Salary" AS category,
14+
sum(income > 50000) AS accounts_count
15+
FROM Accounts;

0 commit comments

Comments
 (0)