{ "data": { "question": { "questionId": "1390", "questionFrontendId": "1251", "boundTopicId": null, "title": "Average Selling Price", "titleSlug": "average-selling-price", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Easy", "likes": 214, "dislikes": 20, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\":{\"Prices\":[\"product_id\",\"start_date\",\"end_date\",\"price\"],\"UnitsSold\":[\"product_id\",\"purchase_date\",\"units\"]},\"rows\":{\"Prices\":[[1,\"2019-02-17\",\"2019-02-28\",5],[1,\"2019-03-01\",\"2019-03-22\",20],[2,\"2019-02-01\",\"2019-02-20\",15],[2,\"2019-02-21\",\"2019-03-31\",30]],\"UnitsSold\":[[1,\"2019-02-25\",100],[1,\"2019-03-01\",15],[2,\"2019-02-10\",200],[2,\"2019-03-22\",30]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"32.7K\", \"totalSubmission\": \"39.3K\", \"totalAcceptedRaw\": 32741, \"totalSubmissionRaw\": 39261, \"acRate\": \"83.4%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"Prices\":[\"product_id\",\"start_date\",\"end_date\",\"price\"],\"UnitsSold\":[\"product_id\",\"purchase_date\",\"units\"]},\"rows\":{\"Prices\":[[1,\"2019-02-17\",\"2019-02-28\",5],[1,\"2019-03-01\",\"2019-03-22\",20],[2,\"2019-02-01\",\"2019-02-20\",15],[2,\"2019-02-21\",\"2019-03-31\",30]],\"UnitsSold\":[[1,\"2019-02-25\",100],[1,\"2019-03-01\",15],[2,\"2019-02-10\",200],[2,\"2019-03-22\",30]]}}", "metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Prices (product_id int, start_date date, end_date date, price int)\",\n \"Create table If Not Exists UnitsSold (product_id int, purchase_date date, units int)\"\n ],\n \"mssql\": [\n \"Create table Prices (product_id int, start_date date, end_date date, price int)\",\n \"Create table UnitsSold (product_id int, purchase_date date, units int)\"\n ],\n \"oraclesql\": [\n \"Create table Prices (product_id int, start_date date, end_date date, price int)\",\n \"Create table UnitsSold (product_id int, purchase_date date, units int)\",\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 Prices (product_id int, start_date date, end_date date, price int)", "Create table If Not Exists UnitsSold (product_id int, purchase_date date, units int)", "Truncate table Prices", "insert into Prices (product_id, start_date, end_date, price) values ('1', '2019-02-17', '2019-02-28', '5')", "insert into Prices (product_id, start_date, end_date, price) values ('1', '2019-03-01', '2019-03-22', '20')", "insert into Prices (product_id, start_date, end_date, price) values ('2', '2019-02-01', '2019-02-20', '15')", "insert into Prices (product_id, start_date, end_date, price) values ('2', '2019-02-21', '2019-03-31', '30')", "Truncate table UnitsSold", "insert into UnitsSold (product_id, purchase_date, units) values ('1', '2019-02-25', '100')", "insert into UnitsSold (product_id, purchase_date, units) values ('1', '2019-03-01', '15')", "insert into UnitsSold (product_id, purchase_date, units) values ('2', '2019-02-10', '200')", "insert into UnitsSold (product_id, purchase_date, units) values ('2', '2019-03-22', '30')" ], "enableRunCode": true, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"mysql\": [\"MySQL\", \"
MySQL 8.0
.
mssql server 2019
.
Oracle Sql 11.2
.