{ "data": { "question": { "questionId": "2381", "questionFrontendId": "2252", "boundTopicId": null, "title": "Dynamic Pivoting of a Table", "titleSlug": "dynamic-pivoting-of-a-table", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Hard", "likes": 26, "dislikes": 7, "isLiked": null, "similarQuestions": "[{\"title\": \"Product's Price for Each Store\", \"titleSlug\": \"products-price-for-each-store\", \"difficulty\": \"Easy\", \"translatedTitle\": null}]", "exampleTestcases": "{\"headers\":{\"Products\":[\"product_id\",\"store\",\"price\"]},\"rows\":{\"Products\":[[1,\"Shop\",110],[1,\"LC_Store\",100],[2,\"Nozama\",200],[2,\"Souq\",190],[3,\"Shop\",1000],[3,\"Souq\",1900]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"1.2K\", \"totalSubmission\": \"2.3K\", \"totalAcceptedRaw\": 1240, \"totalSubmissionRaw\": 2303, \"acRate\": \"53.8%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"Products\":[\"product_id\",\"store\",\"price\"]},\"rows\":{\"Products\":[[1,\"Shop\",110],[1,\"LC_Store\",100],[2,\"Nozama\",200],[2,\"Souq\",190],[3,\"Shop\",1000],[3,\"Souq\",1900]]}}", "metaData": "{\"mysql\": [\"Create table If Not Exists Products (product_id int, store varchar(7), price int)\"], \"mssql\": [\"Create table Products (product_id int, store varchar(7), price int)\"], \"oraclesql\": [\"Create table Products (product_id int, store varchar(7), price int)\"], \"database\": true, \"manual\": true, \"name\": \"dynamic_pivoting_table\", \"pythondata\": [\"Products = pd.DataFrame([], columns=['product_id', 'store', 'price']).astype({'product_id':'Int64', 'store':'object', 'price':'Int64'})\"], \"database_schema\": {\"Products\": {\"product_id\": \"INT\", \"store\": \"VARCHAR(7)\", \"price\": \"INT\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Products (product_id int, store varchar(7), price int)", "Truncate table Products", "insert into Products (product_id, store, price) values ('1', 'Shop', '110')", "insert into Products (product_id, store, price) values ('1', 'LC_Store', '100')", "insert into Products (product_id, store, price) values ('2', 'Nozama', '200')", "insert into Products (product_id, store, price) values ('2', 'Souq', '190')", "insert into Products (product_id, store, price) values ('3', 'Shop', '1000')", "insert into Products (product_id, store, price) values ('3', 'Souq', '1900')" ], "enableRunCode": true, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"mysql\": [\"MySQL\", \"

MySQL 8.0.

\"], \"mssql\": [\"MS SQL Server\", \"

mssql server 2019.

\"], \"oraclesql\": [\"Oracle\", \"

Oracle Sql 11.2.

\"], \"pythondata\": [\"Pandas\", \"

Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0

\"], \"postgresql\": [\"PostgreSQL\", \"

PostgreSQL 16

\"]}", "libraryUrl": null, "adminUrl": null, "challengeQuestion": null, "__typename": "QuestionNode" } } }