8000 Update README.md · Atharv625/sql-50-leetcode@f51c125 · GitHub
[go: up one dir, main page]

Skip to content

Commit f51c125

Browse files
committed
Update README.md
1 parent 2597d2b commit f51c125

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,4 +592,18 @@ GROUP BY title
592592
ORDER BY AVG(rating) DESC, title ASC
593593
LIMIT 1
594594
)
595+
```
596+
597+
[1321. Restaurant Growth](https://leetcode.com/problems/restaurant-growth/)
598+
```sql
599+
-- pay: last 7 days (today inclusive) - avg.amt (round, 2)
600+
601+
SELECT visited_on, amount, ROUND(amount/7, 2) AS average_amount
602+
FROM (
603+
SELECT DISTINCT visited_on,
604+
SUM(amount) OVER(ORDER BY visited_on RANGE BETWEEN INTERVAL 6 DAY PRECEDING AND CURRENT ROW) AS amount,
605+
MIN(visited_on) OVER() day_1
606+
FROM Customer
607+
) t
608+
WHERE visited_on >= day_1+6;
595609
```

0 commit comments

Comments
 (0)
0