Skip to content

Commit 31138da

Browse files
authored
Added 10 More Answers
1 parent 0396043 commit 31138da

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

Diff for: LeetCode/Readme.md

+41-9
Original file line numberDiff line numberDiff line change
@@ -94,40 +94,72 @@ and t.Request_at between '2013-10-01' and '2013-10-03'
9494
group by t.Request_at;
9595
```
9696

97-
12. []()
97+
12. [Find Customer Referee](https://leetcode.com/problems/find-customer-referee/)
9898
```SQL
99+
select name from customer where referee_id <> 2 OR referee_id IS NULL
99100
```
100101

101-
13. []()
102+
13. [Customer Placing the Largest Number of Orders](https://leetcode.com/problems/customer-placing-the-largest-number-of-orders/)
102103
```SQL
104+
select customer_number from orders
105+
group by customer_number
106+
order by count(order_number) desc limit 1;
103107
```
104108

105-
14. []()
109+
14. [Big Countries](https://leetcode.com/problems/big-countries/)
106110
```SQL
111+
select name, population, area from world
112+
where area >= 3000000 or population >= 25000000
107113
```
108114

109-
15. []()
115+
15. [Sales Person](https://leetcode.com/problems/sales-person/)
110116
```SQL
117+
SELECT name from salesperson
118+
where sales_id not in
119+
(
120+
select sales_id from orders where com_id in
121+
(select com_id from company where name='RED')
122+
)
111123
```
112124

113-
16. []()
125+
16. [Tree Node](https://leetcode.com/problems/tree-node/)
114126
```SQL
127+
SELECT id,
128+
IF (p_id IS NULL, "Root",
129+
IF (id IN (SELECT p_id FROM Tree), "Inner", "Leaf")
130+
) AS type
131+
FROM Tree
115132
```
116133

117-
17. []()
134+
17. [Swap Salary](https://leetcode.com/problems/swap-salary/)
118135
```SQL
136+
UPDATE salary SET sex = IF(sex = 'm', 'f', 'm')
119137
```
120138

121-
18. []()
139+
18. [Actors and Directors Who Cooperated At Least Three Times](https://leetcode.com/problems/actors-and-directors-who-cooperated-at-least-three-times/)
122140
```SQL
141+
select actor_id, director_id
142+
from ActorDirector
143+
group by actor_id, director_id
144+
having count(timestamp) > 2
123145
```
124146

125-
19. []()
147+
19. [Sales Analysis III](https://leetcode.com/problems/sales-analysis-iii/)
126148
```SQL
149+
SELECT s.product_id, product_name
150+
FROM Sales s
151+
LEFT JOIN Product p
152+
ON s.product_id = p.product_id
153+
GROUP BY s.product_id
154+
HAVING MIN(sale_date) >= CAST('2019-01-01' AS DATE) AND
155+
MAX(sale_date) <= CAST('2019-03-31' AS DATE)
127156
```
128157

129-
20. []()
158+
20. [Game Play Analysis I](https://leetcode.com/problems/game-play-analysis-i/)
130159
```SQL
160+
select player_id, min(event_date) as first_login
161+
from activity
162+
group by player_id
131163
```
132164

133165
. []()

0 commit comments

Comments
 (0)