{ "data": { "question": { "questionId": "1623", "questionFrontendId": "1479", "boundTopicId": null, "title": "Sales by Day of the Week", "titleSlug": "sales-by-day-of-the-week", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Hard", "likes": 148, "dislikes": 37, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\": {\"Orders\": [\"order_id\", \"customer_id\", \"order_date\", \"item_id\", \"quantity\"], \"Items\": [\"item_id\", \"item_name\", \"item_category\"]}, \"rows\": {\"Orders\": [[1, 1, \"2020-06-01\", 1, 10], [2, 1, \"2020-06-08\", 2, 10], [3, 2, \"2020-06-02\", 1, 5], [4, 3, \"2020-06-03\", 3, 5], [5, 4, \"2020-06-04\", 4, 1], [6, 4, \"2020-06-05\", 5, 5], [7, 5, \"2020-06-05\", 1, 10], [8, 5, \"2020-06-14\", 4, 5], [9, 5, \"2020-06-21\", 3, 5]], \"Items\": [[1, \"LC Alg. Book\", \"Book\"], [2, \"LC DB. Book\", \"Book\"], [3, \"LC SmarthPhone\", \"Phone\"], [4, \"LC Phone 2020\", \"Phone\"], [5, \"LC SmartGlass\", \"Glasses\"], [6, \"LC T-Shirt XL\", \"T-shirt\"]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"16.5K\", \"totalSubmission\": \"21.1K\", \"totalAcceptedRaw\": 16545, \"totalSubmissionRaw\": 21052, \"acRate\": \"78.6%\"}", "hints": [], "solution": { "id": "2212", "canSeeDetail": true, "paidOnly": false, "hasVideoSolution": false, "paidOnlyVideo": true, "__typename": "ArticleNode" }, "status": null, "sampleTestCase": "{\"headers\": {\"Orders\": [\"order_id\", \"customer_id\", \"order_date\", \"item_id\", \"quantity\"], \"Items\": [\"item_id\", \"item_name\", \"item_category\"]}, \"rows\": {\"Orders\": [[1, 1, \"2020-06-01\", 1, 10], [2, 1, \"2020-06-08\", 2, 10], [3, 2, \"2020-06-02\", 1, 5], [4, 3, \"2020-06-03\", 3, 5], [5, 4, \"2020-06-04\", 4, 1], [6, 4, \"2020-06-05\", 5, 5], [7, 5, \"2020-06-05\", 1, 10], [8, 5, \"2020-06-14\", 4, 5], [9, 5, \"2020-06-21\", 3, 5]], \"Items\": [[1, \"LC Alg. Book\", \"Book\"], [2, \"LC DB. Book\", \"Book\"], [3, \"LC SmarthPhone\", \"Phone\"], [4, \"LC Phone 2020\", \"Phone\"], [5, \"LC SmartGlass\", \"Glasses\"], [6, \"LC T-Shirt XL\", \"T-shirt\"]]}}", "metaData": "{\"mysql\": [\"Create table If Not Exists Orders (order_id int, customer_id int, order_date date, item_id varchar(30), quantity int)\", \"Create table If Not Exists Items (item_id varchar(30), item_name varchar(30), item_category varchar(30))\"], \"mssql\": [\"Create table Orders (order_id int, customer_id int, order_date date, item_id varchar(30), quantity int)\", \"Create table Items (item_id varchar(30), item_name varchar(30), item_category varchar(30))\"], \"oraclesql\": [\"Create table Orders (order_id int, customer_id int, order_date date, item_id varchar(30), quantity int)\", \"Create table Items (item_id varchar(30), item_name varchar(30), item_category varchar(30))\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"], \"database\": true, \"name\": \"sales_by_day\", \"pythondata\": [\"Orders = pd.DataFrame([], columns=['order_id', 'customer_id', 'order_date', 'item_id', 'quantity']).astype({'order_id':'Int64', 'customer_id':'Int64', 'order_date':'datetime64[ns]', 'item_id':'object', 'quantity':'Int64'})\", \"Items = pd.DataFrame([], columns=['item_id', 'item_name', 'item_category']).astype({'item_id':'object', 'item_name':'object', 'item_category':'object'})\"], \"postgresql\": [\"\\nCreate table If Not Exists Orders (order_id int, customer_id int, order_date date, item_id varchar(30), quantity int)\", \"Create table If Not Exists Items (item_id varchar(30), item_name varchar(30), item_category varchar(30))\"], \"database_schema\": {\"Orders\": {\"order_id\": \"INT\", \"customer_id\": \"INT\", \"order_date\": \"DATE\", \"item_id\": \"VARCHAR(30)\", \"quantity\": \"INT\"}, \"Items\": {\"item_id\": \"VARCHAR(30)\", \"item_name\": \"VARCHAR(30)\", \"item_category\": \"VARCHAR(30)\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Orders (order_id int, customer_id int, order_date date, item_id varchar(30), quantity int)", "Create table If Not Exists Items (item_id varchar(30), item_name varchar(30), item_category varchar(30))", "Truncate table Orders", "insert into Orders (order_id, customer_id, order_date, item_id, quantity) values ('1', '1', '2020-06-01', '1', '10')", "insert into Orders (order_id, customer_id, order_date, item_id, quantity) values ('2', '1', '2020-06-08', '2', '10')", "insert into Orders (order_id, customer_id, order_date, item_id, quantity) values ('3', '2', '2020-06-02', '1', '5')", "insert into Orders (order_id, customer_id, order_date, item_id, quantity) values ('4', '3', '2020-06-03', '3', '5')", "insert into Orders (order_id, customer_id, order_date, item_id, quantity) values ('5', '4', '2020-06-04', '4', '1')", "insert into Orders (order_id, customer_id, order_date, item_id, quantity) values ('6', '4', '2020-06-05', '5', '5')", "insert into Orders (order_id, customer_id, order_date, item_id, quantity) values ('7', '5', '2020-06-05', '1', '10')", "insert into Orders (order_id, customer_id, order_date, item_id, quantity) values ('8', '5', '2020-06-14', '4', '5')", "insert into Orders (order_id, customer_id, order_date, item_id, quantity) values ('9', '5', '2020-06-21', '3', '5')", "Truncate table Items", "insert into Items (item_id, item_name, item_category) values ('1', 'LC Alg. Book', 'Book')", "insert into Items (item_id, item_name, item_category) values ('2', 'LC DB. Book', 'Book')", "insert into Items (item_id, item_name, item_category) values ('3', 'LC SmarthPhone', 'Phone')", "insert into Items (item_id, item_name, item_category) values ('4', 'LC Phone 2020', 'Phone')", "insert into Items (item_id, item_name, item_category) values ('5', 'LC SmartGlass', 'Glasses')", "insert into Items (item_id, item_name, item_category) values ('6', 'LC T-Shirt XL', 'T-shirt')" ], "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" } } }