{ "data": { "question": { "questionId": "1518", "questionFrontendId": "1384", "categoryTitle": "Database", "boundTopicId": 158843, "title": "Total Sales Amount by Year", "titleSlug": "total-sales-amount-by-year", "content": null, "translatedTitle": "按年度列出销售总额", "translatedContent": null, "isPaidOnly": true, "difficulty": "Hard", "likes": 51, "dislikes": 0, "isLiked": null, "similarQuestions": "[]", "contributors": [], "langToValidPlayground": null, "topicTags": [ { "name": "Database", "slug": "database", "translatedName": "数据库", "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"5.4K\", \"totalSubmission\": \"9.4K\", \"totalAcceptedRaw\": 5366, \"totalSubmissionRaw\": 9369, \"acRate\": \"57.3%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\": {\"Product\": [\"product_id\", \"product_name\"], \"Sales\": [\"product_id\", \"period_start\", \"period_end\", \"average_daily_sales\"]}, \"rows\": {\"Product\": [[1, \"LC Phone \"], [2, \"LC T-Shirt\"], [3, \"LC Keychain\"]], \"Sales\": [[1, \"2019-01-25\", \"2019-02-28\", 100], [2, \"2018-12-01\", \"2020-01-01\", 10], [3, \"2019-12-01\", \"2020-01-31\", 1]]}}", "metaData": "{\"mysql\":[\"Create table If Not Exists Product (product_id int, product_name varchar(30))\",\"Create table If Not Exists Sales (product_id int, period_start date, period_end date, average_daily_sales int)\"],\"mssql\":[\"Create table Product (product_id int, product_name varchar(30))\",\"Create table Sales (product_id int, period_start date, period_end date, average_daily_sales int)\"],\"oraclesql\":[\"Create table Product (product_id int, product_name varchar(30))\",\"Create table Sales (product_id int, period_start date, period_end date, average_daily_sales int)\",\"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"],\"database\":true,\"name\":\"total_sales\",\"pythondata\":[\"Product = pd.DataFrame([], columns=['product_id', 'product_name']).astype({'product_id':'Int64', 'product_name':'object'})\",\"Sales = pd.DataFrame([], columns=['product_id', 'period_start', 'period_end', 'average_daily_sales']).astype({'product_id':'Int64', 'period_start':'datetime64[ns]', 'period_end':'datetime64[ns]', 'average_daily_sales':'Int64'})\"],\"postgresql\":[\"\\nCreate table If Not Exists Product (product_id int, product_name varchar(30))\\n\",\"Create table If Not Exists Sales (product_id int, period_start date, period_end date, average_daily_sales int)\"],\"database_schema\":{\"Product\":{\"product_id\":\"INT\",\"product_name\":\"VARCHAR(30)\"},\"Sales\":{\"product_id\":\"INT\",\"period_start\":\"DATE\",\"period_end\":\"DATE\",\"average_daily_sales\":\"INT\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Product (product_id int, product_name varchar(30))", "Create table If Not Exists Sales (product_id int, period_start date, period_end date, average_daily_sales int)", "Truncate table Product", "insert into Product (product_id, product_name) values ('1', 'LC Phone ')", "insert into Product (product_id, product_name) values ('2', 'LC T-Shirt')", "insert into Product (product_id, product_name) values ('3', 'LC Keychain')", "Truncate table Sales", "insert into Sales (product_id, period_start, period_end, average_daily_sales) values ('1', '2019-01-25', '2019-02-28', '100')", "insert into Sales (product_id, period_start, period_end, average_daily_sales) values ('2', '2018-12-01', '2020-01-01', '10')", "insert into Sales (product_id, period_start, period_end, average_daily_sales) values ('3', '2019-12-01', '2020-01-31', '1')" ], "enableRunCode": true, "envInfo": "{\"mysql\":[\"MySQL\",\"
\\u7248\\u672c\\uff1a mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\" Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\" Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\" PostgreSQL 16<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\": {\"Product\": [\"product_id\", \"product_name\"], \"Sales\": [\"product_id\", \"period_start\", \"period_end\", \"average_daily_sales\"]}, \"rows\": {\"Product\": [[1, \"LC Phone \"], [2, \"LC T-Shirt\"], [3, \"LC Keychain\"]], \"Sales\": [[1, \"2019-01-25\", \"2019-02-28\", 100], [2, \"2018-12-01\", \"2020-01-01\", 10], [3, \"2019-12-01\", \"2020-01-31\", 1]]}}",
"__typename": "QuestionNode"
}
}
}MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"