File tree 1 file changed +51
-1
lines changed
1 file changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -307,4 +307,54 @@ FROM first_year_sales f
307
307
JOIN Sales s
308
308
ON f .product_id = s .product_id
309
309
AND f .first_year = s .year
310
- ```
310
+ ```
311
+
312
+ [ 596. Classes More Than 5 Students] ( https://leetcode.com/problems/classes-more-than-5-students/ )
313
+ ``` sql
314
+ SELECT class
315
+ FROM Courses
316
+ GROUP BY class
317
+ HAVING COUNT (student) >= 5
318
+ ```
319
+
320
+ [ 1729. Find Followers Count] ( https://leetcode.com/problems/find-followers-count/ )
321
+ ``` sql
322
+ SELECT user_id, COUNT (DISTINCT follower_id) AS followers_count
323
+ FROM Followers
324
+ GROUP BY user_id
325
+ ORDER BY user_id ASC
326
+ ```
327
+
328
+ [ 619. Biggest Single Number] ( https://leetcode.com/problems/biggest-single-number/ )
329
+ ``` sql
330
+ SELECT COALESCE(
331
+ (SELECT num
332
+ FROM MyNumbers
333
+ GROUP BY num
334
+ HAVING COUNT (num) = 1
335
+ ORDER BY num DESC
336
+ LIMIT 1 ), null )
337
+ AS num
338
+ ```
339
+
340
+ [ 1045. Customers Who Bought All Products] ( https://leetcode.com/problems/customers-who-bought-all-products/ )
341
+ ``` sql
342
+ SELECT customer_id
343
+ FROM Customer
344
+ GROUP BY customer_id
345
+ HAVING COUNT (DISTINCT product_key) = (
346
+ SELECT COUNT (product_key)
347
+ FROM Product
348
+ )
349
+ ```
350
+ [ 1731. The Number of Employees Which Report to Each Employee
351
+ ] ( https://leetcode.com/problems/the-number-of-employees-which-report-to-each-employee/ )
352
+
353
+ ``` sql
354
+ SELECT e1 .employee_id , e1 .name , COUNT (e2 .employee_id ) reports_count, ROUND(AVG (e2 .age )) average_age
355
+ FROM Employees e1, Employees e2
356
+ WHERE e1 .employee_id = e2 .reports_to
357
+ GROUP BY e1 .employee_id
358
+ HAVING reports_count > 0
359
+ ORDER BY e1 .employee_id
360
+ ```
You can’t perform that action at this time.
0 commit comments