SQL: Daily Product Sales Summary
\n# Code\n\nSELECT \n    sell_date,\n    COUNT(DISTINCT product) AS num_sold,\n    GROUP_CONCAT(DISTINCT product ORDER BY product SEPARATOR \',\') AS products\n
\n# Code\n```\nSELECT \n    sell_date,\n    COUNT(DISTINCT product) AS num_sold,\n    GROUP_CONCAT(DISTINCT product ORDER BY product SEPARATOR \',\') AS products\nFROM activities\nGROUP BY sell_date\nORDER BY sell_date ASC;\n\n```\n\n##### GROUP_CONCAT Function\n```\nGROUP_CONCAT(column_name ORDER BY some_column SEPARATOR \'separator\')\n```\n- column_name: The column whose values you want to concatenate.\n- ORDER BY some_column: Optional clause to sort the values in a specific order.\n- SEPARATOR \'separator\': Optional clause to specify a string to separate the concatenated values. By default, it uses a comma (,).\n\n# Complexity\n- Time complexity: $$O(n log n)$$ due to the sorting required for both the GROUP BY and ORDER BY clauses, where n is the number of rows in the table.\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(k)$$, where k is the number of distinct sell dates. \n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n![upvote_leetcode.png](https://assets.leetcode.com/users/images/06d53f1d-4d5a-46af-b244-bef4a9f4c6f6_1704391727.118957.png)\n
['MySQL']