Practice Group Sold Products By The Date
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Tables: Activities(sell_date DATE, product VARCHAR). Activities permits duplicate rows. Each row records a product sold on sell_date. Return sell_date, num_sold and products for each date. Count distinct product names and join those distinct names with commas in lexicographical order, without added spaces. Sort result rows by sell_date ascending.
Source: Group Sold Products By The Date on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Activities table: +------------+------------+ | sell_date | product | +------------+------------+ | 2020-05-30 | Headphone | | 2020-06-01 | Pencil | | 2020-06-02 | Mask | | 2020-05-30 | Basketball | | 2020-06-01 | Bible | | 2020-06-02 | Mask | | 2020-05-30 | T-Shirt | +------------+------------+
+------------+----------+------------------------------+ | sell_date | num_sold | products | +------------+----------+------------------------------+ | 2020-05-30 | 3 | Basketball,Headphone,T-shirt | | 2020-06-01 | 2 | Bible,Pencil | | 2020-06-02 | 1 | Mask | +------------+----------+------------------------------+
Related LeetCode Problems
Practice more problems similar to Group Sold Products By The Date.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.