Oracle SQL Solution and Explanation.
Solution & explanation -\nThe below code is not working but as per the oracle it should work.\nClick this link to check on oracle website.\n\n\n/* Write your PL
# Solution & explanation -\nThe below code is not working but as per the oracle it should work.\nClick this [link](https://livesql.oracle.com/apex/livesql/file/content_HT1O85E4BHSBWN93G1B3M8SI2.html) to check on oracle website.\n\n```\n/* Write your PL/SQL query statement below */\n\nSELECT TO_CHAR(sell_date, \'YYYY-MM-DD\') AS "sell_date", \nCOUNT(DISTINCT(product)) AS "num_sold",\nLISTAGG(DISTINCT(product), \',\') WITHIN GROUP (ORDER BY product) AS "products"\nFROM activities \nGROUP BY sell_date \nORDER BY sell_date;\n```\n\nIn question description, it is mentioned as **"There is no primary key for this table, it may contain duplicates"** and it contains duplicate values. So just fetch unqiue values of product & sell_date columns from activities table instead of fetching directly from the activities table. Check the below code.\n```\n/* Write your PL/SQL query statement below */\n\nSELECT TO_CHAR(sell_date, \'YYYY-MM-DD\') AS "sell_date", \nCOUNT(DISTINCT(product)) AS "num_sold",\nLISTAGG(product, \',\') WITHIN GROUP (ORDER BY product) AS "products"\nFROM (\n    SELECT DISTINCT product, sell_date \n    FROM activities\n) \nGROUP BY sell_date \nORDER BY sell_date;\n```\n\nI hope it is helpful to you.\n
['Oracle']