Skip to content

Commit 2187155

Browse files
committed
Upload 140
1 parent 7d8d173 commit 2187155

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ The problems and both submitted and site solutions are documented in individual
172172
| 137 | [Fix Names in a Table](https://leetcode.com/problems/fix-names-in-a-table/description/) | [Solution](solutions/137_fix_names_in_a_table.md) | LeetCode | Easy | `SUBSTRING()` |
173173
| 138 | [Patients With a Condition](https://leetcode.com/problems/patients-with-a-condition/description/) | [Solution](solutions/138_patients_with_a_condition.md) | LeetCode | Easy | |
174174
| 139 | [Second Highest Salary](https://leetcode.com/problems/second-highest-salary/description/) | [Solution](solutions/139_second_highest_salary.md) | LeetCode | Medium | |
175+
| 140 | [Group Sold Products By The Date](https://leetcode.com/problems/group-sold-products-by-the-date/description/) | [Solution](solutions/140_group_sold_products_by_the_date.md) | DataLemur | Easy | `GROUP_CONCAT()` |
175176
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
176177

177178
## Author(s)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SQL Everyday \#140
2+
3+
## Group Sold Products By The Date
4+
5+
Site: DataLemur\
6+
Difficulty per Site: Easy
7+
8+
## Problem
9+
10+
Write a solution to find for each date the number of different products sold and their names.
11+
12+
The sold products names for each date should be sorted lexicographically.
13+
14+
Return the result table ordered by `sell_date`. [[Full Description](https://leetcode.com/problems/group-sold-products-by-the-date/description/)]
15+
16+
## Submitted Solution
17+
18+
```sql
19+
-- Submitted Solution
20+
SELECT
21+
sell_date
22+
,COUNT(DISTINCT product) AS num_sold
23+
,GROUP_CONCAT(DISTINCT product ORDER BY product SEPARATOR ",") AS products
24+
FROM Activities
25+
GROUP BY sell_date
26+
ORDER BY sell_date ASC, products ASC
27+
;
28+
```
29+
30+
## Site Solution
31+
32+
```sql
33+
-- DataLemur Solution
34+
-- TBD
35+
```
36+
37+
## Notes
38+
39+
TBD
40+
41+
## NB
42+
43+
`GROUP_CONCAT()`
44+
45+
Go to [Index](../?tab=readme-ov-file#index)\
46+
Go to [Overview](../?tab=readme-ov-file)

0 commit comments

Comments
 (0)