Skip to content

Commit c8c2132

Browse files
committed
Update README.md
1 parent 1182159 commit c8c2132

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,49 @@ HAVING COUNT(*) >= 5
135135

136136
[1934. Confirmation Rate](https://leetcode.com/problems/confirmation-rate/)
137137
```sql
138+
SELECT
139+
s.user_id,
140+
ROUND(
141+
COALESCE(
142+
SUM(
143+
CASE WHEN ACTION = 'confirmed' THEN 1 END
144+
) / COUNT(*), 0),2)
145+
AS confirmation_rate
146+
FROM Signups s
147+
LEFT JOIN Confirmations c
148+
ON s.user_id = c.user_id
149+
GROUP BY s.user_id;
150+
```
138151

152+
[620. Not Boring Movies](https://leetcode.com/problems/not-boring-movies)
153+
```sql
154+
-- odd id, "boring", rating desc
155+
SELECT *
156+
FROM Cinema
157+
WHERE id % 2 <> 0
158+
AND description <> "boring"
159+
ORDER BY rating DESC
139160
```
161+
162+
[1251. Average Selling Price](https://leetcode.com/problems/average-selling-price/)
163+
```sql
164+
-- avg(selling), round 2
165+
SELECT p.product_id,
166+
ROUND(SUM(price * units) / SUM(units), 2) AS average_price
167+
FROM Prices p
168+
LEFT JOIN UnitsSold s
169+
ON p.product_id = s.product_id
170+
AND purchase_date BETWEEN start_date AND end_date
171+
GROUP BY p.product_id
172+
```
173+
174+
[1075. Project Employees I](https://leetcode.com/problems/project-employees-i)
175+
```sql
176+
-- avg(exp_yr), round 2, by project
177+
SELECT project_id, ROUND(AVG(experience_years), 2) average_years
178+
FROM Project p
179+
LEFT JOIN Employee e
180+
ON p.employee_id = e.employee_id
181+
GROUP BY project_id
182+
183+
```

0 commit comments

Comments
 (0)