💯SIMPLE | Explanation 2023🟢 | EASY💡
SELECT-> sell_date: This part of the query selects the sell_date column, which represents the date of sales activities.\n\nCOUNT-> (DISTINCT product) AS num_sol
`SELECT`-> sell_date: This part of the query selects the sell_date column, which represents the date of sales activities.\n\n`COUNT`-> (DISTINCT product) AS num_sold: This part counts the number of distinct products sold on each sell_date. The result is given the alias num_sold, which will represent the count of unique products sold on that particular date.\n\n`GROUP_CONCAT`-> (`DISTINCT` product `ORDER BY` product `ASC` SEPARATOR \',\') `AS` products: This part aggregates the distinct product names, ordered in ascending alphabetical order (`ORDER BY` product `ASC`), and separates them with a comma (\',\'). The result is given the alias products.\n\n`FROM`->  Activities: This specifies that the data is being retrieved from the Activities table, which likely contains records of sales activities with information about the sell date and the products sold.\n\n`GROUP BY`-> sell_date: This clause groups the results by the sell_date, meaning that it will aggregate the data based on the sell date. Each unique sell date will have its own row in the result set.\n\n`ORDER BY`-> sell_date `ASC`: Finally, the results are sorted in ascending order based on the sell_date, which means the dates will be listed in chronological order.\n\n---\n\n\n![image.png](https://assets.leetcode.com/users/images/0c0eced3-7003-47d7-89cd-29d4d9b34183_1697357909.4474247.png)\n\n# Code\n```\nSELECT sell_date, COUNT(DISTINCT(product)) AS num_sold, GROUP_CONCAT(DISTINCT product \nORDER BY product \nASC SEPARATOR \',\') \nAS products\nFROM Activities\nGROUP BY sell_date\nORDER BY sell_date \nASC\n```
['MySQL']