8000 Create README.md · Learner457/sql-50-leetcode@57d4ae0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 57d4ae0

Browse files
committed
Create README.md
1 parent 8026827 commit 57d4ae0

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SQL 50 - LeetCode
2+
Solutions for [SQL 50 Study Plan](https://leetcode.com/studyplan/top-sql-50/) on LeetCode
3+
4+
---
5+
6+
1757 - Recyclable and Low Fat Products
7+
```sql
8+
SELECT product_id
9+
FROM Products
10+
WHERE low_fats = 'Y'
11+
AND recyclable = 'Y'
12+
```
13+
14+
584 - Find Customer Referee
15+
```sql
16+
SELECT name
17+
FROM Customer
18+
WHERE referee_id != 2 OR referee_id IS null
19+
```
20+
21+
595 - Big Countries
22+
```sql
23+
SELECT name, population, area
24+
FROM WORLD
25+
WHERE area >= 3000000
26+
OR population >= 25000000
27+
```
28+
29+
1148 - Article Views I
30+
```sql
31+
SELECT DISTINCT author_id as id
32+
FROM Views
33+
WHERE viewer_id >= 1
34+
AND author_id = viewer_id
35+
ORDER BY author_id
36+
```
37+
38+
1683 - Invalid Tweets
39+
```sql
40+
SELECT tweet_id
41+
FROM Tweets
42+
WHERE length(content) > 15
43+
```
44+
45+
1378 - Replace Employee ID With The Unique
46+
Identifier
47+
```sql
48+
SELECT unique_id, name
49+
FROM Employees e
50+
LEFT JOIN EmployeeUNI eu
51+
ON e.id = eu.id
52+
```
53+
54+
1068 - Product Sales Analysis I
55+
```sql
56+
SELECT product_name, year, price
57+
FROM Sales s
58+
LEFT JOIN Product p
59+
ON s.product_id = p.product_id
60+
```
61+
62+
1581 - Customer Who Visited but Did Not Make Any Transactions
63+
```sql
64+
SELECT customer_id, COUNT(*) as count_no_trans
65+
FROM Visits
66+
WHERE visit_id NOT IN (SELECT DISTINCT visit_id FROM Transactions)
67+
GROUP BY customer_id
68+
```
69+
70+
71+
72+

0 commit comments

Comments
 (0)
0