{ "data": { "question": { "questionId": "2501", "questionFrontendId": "2362", "boundTopicId": null, "title": "Generate the Invoice", "titleSlug": "generate-the-invoice", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Hard", "likes": 30, "dislikes": 24, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\":{\"Products\":[\"product_id\",\"price\"],\"Purchases\":[\"invoice_id\",\"product_id\",\"quantity\"]},\"rows\":{\"Products\":[[1,100],[2,200]],\"Purchases\":[[1,1,2],[3,2,1],[2,2,3],[2,1,4],[4,1,10]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"2.5K\", \"totalSubmission\": \"3.4K\", \"totalAcceptedRaw\": 2494, \"totalSubmissionRaw\": 3394, \"acRate\": \"73.5%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"Products\":[\"product_id\",\"price\"],\"Purchases\":[\"invoice_id\",\"product_id\",\"quantity\"]},\"rows\":{\"Products\":[[1,100],[2,200]],\"Purchases\":[[1,1,2],[3,2,1],[2,2,3],[2,1,4],[4,1,10]]}}", "metaData": "{\"mysql\": [\"Create table If Not Exists Products (product_id int, price int)\", \"Create table If Not Exists Purchases (invoice_id int, product_id int, quantity int)\"], \"mssql\": [\"Create table Products (product_id int, price int)\", \"Create table Purchases (invoice_id int, product_id int, quantity int)\"], \"oraclesql\": [\"Create table Products (product_id int, price int)\", \"Create table Purchases (invoice_id int, product_id int, quantity int)\"], \"database\": true, \"name\": \"generate_the_invoice\", \"pythondata\": [\"Products = pd.DataFrame([], columns=['product_id', 'price']).astype({'product_id':'Int64', 'price':'Int64'})\", \"Purchases = pd.DataFrame([], columns=['invoice_id', 'product_id', 'quantity']).astype({'invoice_id':'Int64', 'product_id':'Int64', 'quantity':'Int64'})\"], \"postgresql\": [\"Create table If Not Exists Products (product_id int, price int)\", \"Create table If Not Exists Purchases (invoice_id int, product_id int, quantity int)\"], \"database_schema\": {\"Products\": {\"product_id\": \"INT\", \"price\": \"INT\"}, \"Purchases\": {\"invoice_id\": \"INT\", \"product_id\": \"INT\", \"quantity\": \"INT\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Products (product_id int, price int)", "Create table If Not Exists Purchases (invoice_id int, product_id int, quantity int)", "Truncate table Products", "insert into Products (product_id, price) values ('1', '100')", "insert into Products (product_id, price) values ('2', '200')", "Truncate table Purchases", "insert into Purchases (invoice_id, product_id, quantity) values ('1', '1', '2')", "insert into Purchases (invoice_id, product_id, quantity) values ('3', '2', '1')", "insert into Purchases (invoice_id, product_id, quantity) values ('2', '2', '3')", "insert into Purchases (invoice_id, product_id, quantity) values ('2', '1', '4')", "insert into Purchases (invoice_id, product_id, quantity) values ('4', '1', '10')" ], "enableRunCode": true, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"mysql\": [\"MySQL\", \"
MySQL 8.0
.
mssql server 2019
.
Oracle Sql 11.2
.
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" } } }