8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 14e106c commit 7a7e5b8Copy full SHA for 7a7e5b8
README.md
@@ -544,4 +544,18 @@ CASE WHEN MOD(id,2)=0 THEN (LAG(student) OVER (ORDER BY id))
544
ELSE (LEAD(student, 1, student) OVER (ORDER BY id))
545
END AS 'Student'
546
FROM Seat
547
+```
548
+
549
+[1327. List the Products Ordered in a Period](https://leetcode.com/problems/list-the-products-ordered-in-a-period/)
550
+```sql
551
+-- name, amt
552
+-- >= 100 units, feb 2020
553
554
+SELECT p.product_name, SUM(o.unit) AS unit
555
+FROM Products p
556
+LEFT JOIN Orders o
557
+ON p.product_id = o.product_id
558
+WHERE DATE_FORMAT(order_date, '%Y-%m') = '2020-02'
559
+GROUP BY p.product_name
560
+HAVING SUM(o.unit) >= 100
561
```
0 commit comments