"content":"<p>Table <code>Activities</code>:</p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| sell_date | date |\n| product | varchar |\n+-------------+---------+\nThere is no primary key for this table, it may contain duplicates.\nEach row of this table contains the product name and the date it was sold in a market.\n</pre>\n\n<p> </p>\n\n<p>Write an SQL query to find for each date the number of different products sold and their names.</p>\n\n<p>The sold products names for each date should be sorted lexicographically.</p>\n\n<p>Return the result table ordered by <code>sell_date</code>.</p>\n\n<p>The query result format is in the following example.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nActivities table:\n+------------+------------+\n| sell_date | product |\n+------------+------------+\n| 2020-05-30 | Headphone |\n| 2020-06-01 | Pencil |\n| 2020-06-02 | Mask |\n| 2020-05-30 | Basketball |\n| 2020-06-01 | Bible |\n| 2020-06-02 | Mask |\n| 2020-05-30 | T-Shirt |\n+------------+------------+\n<strong>Output:</strong> \n+------------+----------+------------------------------+\n| sell_date | num_sold | products |\n+------------+----------+------------------------------+\n| 2020-05-30 | 3 | Basketball,Headphone,T-shirt |\n| 2020-06-01 | 2 | Bible,Pencil |\n| 2020-06-02 | 1 | Mask |\n+------------+----------+------------------------------+\n<strong>Explanation:</strong> \nFor 2020-05-30, Sold items were (Headphone, Basketball, T-shirt), we sort them lexicographically and separate them by a comma.\nFor 2020-06-01, Sold items were (Pencil, Bible), we sort them lexicographically and separate them by a comma.\nFor 2020-06-02, the Sold item is (Mask), we just return it.\n</pre>\n",