Skip to content

Commit ab7795c

Browse files
committed
Create README.md
2 parents 59de46a + 2270293 commit ab7795c

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

README.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
15+
584 - Find Customer Referee
16+
```sql
17+
SELECT name
18+
FROM Customer
19+
WHERE referee_id != 2 OR referee_id IS null
20+
```
21+
22+
595 - Big Countries
23+
```sql
24+
SELECT name, population, area
25+
FROM WORLD
26+
WHERE area >= 3000000
27+
OR population >= 25000000
28+
```
29+
30+
1148 - Article Views I
31+
```sql
32+
SELECT DISTINCT author_id as id
33+
FROM Views
34+
WHERE viewer_id >= 1
35+
AND author_id = viewer_id
36+
ORDER BY author_id
37+
```
38+
39+
1683 - Invalid Tweets
40+
```sql
41+
SELECT tweet_id
42+
FROM Tweets
43+
WHERE length(content) > 15
44+
```
45+
46+
1378 - Replace Employee ID With The Unique
47+
Identifier
48+
```sql
49+
SELECT unique_id, name
50+
FROM Employees e
51+
LEFT JOIN EmployeeUNI eu
52+
ON e.id = eu.id
53+
```
54+
55+
1068 - Product Sales Analysis I
56+
```sql
57+
SELECT product_name, year, price
58+
FROM Sales s
59+
LEFT JOIN Product p
60+
ON s.product_id = p.product_id
61+
```
62+
63+
1581 - Customer Who Visited but Did Not Make Any Transactions
64+
```sql
65+
SELECT customer_id, COUNT(*) as count_no_trans
66+
FROM Visits
67+
WHERE visit_id NOT IN (SELECT DISTINCT visit_id FROM Transactions)
68+
GROUP BY customer_id
69+
```
70+
71+
72+
73+
74+

0 commit comments

Comments
 (0)