{
    "data": {
        "question": {
            "questionId": "1625",
            "questionFrontendId": "1484",
            "boundTopicId": null,
            "title": "Group Sold Products By The Date",
            "titleSlug": "group-sold-products-by-the-date",
            "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>&nbsp;</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>&nbsp;</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",
            "translatedTitle": null,
            "translatedContent": null,
            "isPaidOnly": false,
            "difficulty": "Easy",
            "likes": 207,
            "dislikes": 14,
            "isLiked": null,
            "similarQuestions": "[{\"title\": \"Finding the Topic of Each Post\", \"titleSlug\": \"finding-the-topic-of-each-post\", \"difficulty\": \"Hard\", \"translatedTitle\": null}]",
            "exampleTestcases": "{\"headers\":{\"Activities\":[\"sell_date\",\"product\"]},\"rows\":{\"Activities\":[[\"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\"]]}}",
            "categoryTitle": "Database",
            "contributors": [],
            "topicTags": [
                {
                    "name": "Database",
                    "slug": "database",
                    "translatedName": null,
                    "__typename": "TopicTagNode"
                }
            ],
            "companyTagStats": null,
            "codeSnippets": [
                {
                    "lang": "MySQL",
                    "langSlug": "mysql",
                    "code": "# Write your MySQL query statement below\n",
                    "__typename": "CodeSnippetNode"
                },
                {
                    "lang": "MS SQL Server",
                    "langSlug": "mssql",
                    "code": "/* Write your T-SQL query statement below */\n",
                    "__typename": "CodeSnippetNode"
                },
                {
                    "lang": "Oracle",
                    "langSlug": "oraclesql",
                    "code": "/* Write your PL/SQL query statement below */\n",
                    "__typename": "CodeSnippetNode"
                }
            ],
            "stats": "{\"totalAccepted\": \"19.8K\", \"totalSubmission\": \"23.3K\", \"totalAcceptedRaw\": 19781, \"totalSubmissionRaw\": 23262, \"acRate\": \"85.0%\"}",
            "hints": [],
            "solution": null,
            "status": null,
            "sampleTestCase": "{\"headers\":{\"Activities\":[\"sell_date\",\"product\"]},\"rows\":{\"Activities\":[[\"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\"]]}}",
            "metaData": "{\n  \"mysql\": [\n    \"Create table If Not Exists Activities (sell_date date, product varchar(20))\"\n  ],\n  \"mssql\": [\n    \"Create table Activities (sell_date date, product varchar(20))\"\n  ],\n  \"oraclesql\": [\n    \"Create table Activities (sell_date date, product varchar(20))\",\n    \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"\n  ],\n  \"database\": true\n}",
            "judgerAvailable": true,
            "judgeType": "large",
            "mysqlSchemas": [
                "Create table If Not Exists Activities (sell_date date, product varchar(20))",
                "Truncate table Activities",
                "insert into Activities (sell_date, product) values ('2020-05-30', 'Headphone')",
                "insert into Activities (sell_date, product) values ('2020-06-01', 'Pencil')",
                "insert into Activities (sell_date, product) values ('2020-06-02', 'Mask')",
                "insert into Activities (sell_date, product) values ('2020-05-30', 'Basketball')",
                "insert into Activities (sell_date, product) values ('2020-06-01', 'Bible')",
                "insert into Activities (sell_date, product) values ('2020-06-02', 'Mask')",
                "insert into Activities (sell_date, product) values ('2020-05-30', 'T-Shirt')"
            ],
            "enableRunCode": true,
            "enableTestMode": false,
            "enableDebugger": false,
            "envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"]}",
            "libraryUrl": null,
            "adminUrl": null,
            "challengeQuestion": null,
            "__typename": "QuestionNode"
        }
    }
}