Skip to content

Commit 6b1ab3c

Browse files
Create README - LeetHub
1 parent 9c0ec79 commit 6b1ab3c

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<h2><a href="https://leetcode.com/problems/count-salary-categories/">1907. Count Salary Categories</a></h2><h3>Medium</h3><hr><div class="sql-schema-wrapper__3VBi"><a class="sql-schema-link__3cEg">SQL Schema<svg viewBox="0 0 24 24" width="1em" height="1em" class="icon__1Md2"><path fill-rule="evenodd" d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></svg></a></div><div><p>Table: <code>Accounts</code></p>
2+
3+
<pre>+-------------+------+
4+
| Column Name | Type |
5+
+-------------+------+
6+
| account_id | int |
7+
| income | int |
8+
+-------------+------+
9+
account_id is the primary key (column with unique values) for this table.
10+
Each row contains information about the monthly income for one bank account.
11+
</pre>
12+
13+
<p>&nbsp;</p>
14+
15+
<p>Write a solution&nbsp;to calculate the number of bank accounts for each salary category. The salary categories are:</p>
16+
17+
<ul>
18+
<li><code>"Low Salary"</code>: All the salaries <strong>strictly less</strong> than <code>$20000</code>.</li>
19+
<li><code>"Average Salary"</code>: All the salaries in the <strong>inclusive</strong> range <code>[$20000, $50000]</code>.</li>
20+
<li><code>"High Salary"</code>: All the salaries <strong>strictly greater</strong> than <code>$50000</code>.</li>
21+
</ul>
22+
23+
<p>The result table <strong>must</strong> contain all three categories. If there are no accounts in a category,&nbsp;return&nbsp;<code>0</code>.</p>
24+
25+
<p>Return the result table in <strong>any order</strong>.</p>
26+
27+
<p>The&nbsp;result format is in the following example.</p>
28+
29+
<p>&nbsp;</p>
30+
<p><strong class="example">Example 1:</strong></p>
31+
32+
<pre><strong>Input:</strong>
33+
Accounts table:
34+
+------------+--------+
35+
| account_id | income |
36+
+------------+--------+
37+
| 3 | 108939 |
38+
| 2 | 12747 |
39+
| 8 | 87709 |
40+
| 6 | 91796 |
41+
+------------+--------+
42+
<strong>Output:</strong>
43+
+----------------+----------------+
44+
| category | accounts_count |
45+
+----------------+----------------+
46+
| Low Salary | 1 |
47+
| Average Salary | 0 |
48+
| High Salary | 3 |
49+
+----------------+----------------+
50+
<strong>Explanation:</strong>
51+
Low Salary: Account 2.
52+
Average Salary: No accounts.
53+
High Salary: Accounts 3, 6, and 8.
54+
</pre>
55+
</div>

0 commit comments

Comments
 (0)