{ "data": { "question": { "questionId": "1654", "questionFrontendId": "1511", "boundTopicId": null, "title": "Customer Order Frequency", "titleSlug": "customer-order-frequency", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Easy", "likes": 303, "dislikes": 57, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\": {\"Customers\": [\"customer_id\", \"name\", \"country\"], \"Product\": [\"product_id\", \"description\", \"price\"], \"Orders\": [\"order_id\", \"customer_id\", \"product_id\", \"order_date\", \"quantity\"]}, \"rows\": {\"Customers\": [[1, \"Winston\", \"USA\"], [2, \"Jonathan\", \"Peru\"], [3, \"Moustafa\", \"Egypt\"]], \"Product\": [[10, \"LC Phone\", 300], [20, \"LC T-Shirt\", 10], [30, \"LC Book\", 45], [40, \"LC Keychain\", 2]], \"Orders\": [[1, 1, 10, \"2020-06-10\", 1], [2, 1, 20, \"2020-07-01\", 1], [3, 1, 30, \"2020-07-08\", 2], [4, 2, 10, \"2020-06-15\", 2], [5, 2, 40, \"2020-07-01\", 10], [6, 3, 20, \"2020-06-24\", 2], [7, 3, 30, \"2020-06-25\", 2], [9, 3, 30, \"2020-05-08\", 3]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"38.7K\", \"totalSubmission\": \"56.1K\", \"totalAcceptedRaw\": 38723, \"totalSubmissionRaw\": 56064, \"acRate\": \"69.1%\"}", "hints": [], "solution": { "id": "2200", "canSeeDetail": true, "paidOnly": false, "hasVideoSolution": false, "paidOnlyVideo": true, "__typename": "ArticleNode" }, "status": null, "sampleTestCase": "{\"headers\": {\"Customers\": [\"customer_id\", \"name\", \"country\"], \"Product\": [\"product_id\", \"description\", \"price\"], \"Orders\": [\"order_id\", \"customer_id\", \"product_id\", \"order_date\", \"quantity\"]}, \"rows\": {\"Customers\": [[1, \"Winston\", \"USA\"], [2, \"Jonathan\", \"Peru\"], [3, \"Moustafa\", \"Egypt\"]], \"Product\": [[10, \"LC Phone\", 300], [20, \"LC T-Shirt\", 10], [30, \"LC Book\", 45], [40, \"LC Keychain\", 2]], \"Orders\": [[1, 1, 10, \"2020-06-10\", 1], [2, 1, 20, \"2020-07-01\", 1], [3, 1, 30, \"2020-07-08\", 2], [4, 2, 10, \"2020-06-15\", 2], [5, 2, 40, \"2020-07-01\", 10], [6, 3, 20, \"2020-06-24\", 2], [7, 3, 30, \"2020-06-25\", 2], [9, 3, 30, \"2020-05-08\", 3]]}}", "metaData": "{\"mysql\": [\"Create table If Not Exists Customers (customer_id int, name varchar(30), country varchar(30))\", \"Create table If Not Exists Product (product_id int, description varchar(30), price int)\\n\", \"Create table If Not Exists Orders (order_id int, customer_id int, product_id int, order_date date, quantity int)\\n\"], \"mssql\": [\"Create table Customers (customer_id int, name varchar(30), country varchar(30))\\n\", \"Create table Product (product_id int, description varchar(30), price int)\", \"Create table Orders (order_id int, customer_id int, product_id int, order_date date, quantity int)\"], \"oraclesql\": [\"Create table Customers (customer_id int, name varchar(30), country varchar(30))\", \"Create table Product (product_id int, description varchar(30), price int)\", \"Create table Orders (order_id int, customer_id int, product_id int, order_date date, quantity int)\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"], \"database\": true, \"name\": \"customer_order_frequency\", \"pythondata\": [\"Customers = pd.DataFrame([], columns=['customer_id', 'name', 'country']).astype({'customer_id':'Int64', 'name':'object', 'country':'object'})\", \"Product = pd.DataFrame([], columns=['product_id', 'description', 'price']).astype({'product_id':'Int64', 'description':'object', 'price':'Int64'})\", \"Orders = pd.DataFrame([], columns=['order_id', 'customer_id', 'product_id', 'order_date', 'quantity']).astype({'order_id':'Int64', 'customer_id':'Int64', 'product_id':'Int64', 'order_date':'datetime64[ns]', 'quantity':'Int64'})\"], \"postgresql\": [\"\\nCreate table If Not Exists Customers (customer_id int, name varchar(30), country varchar(30))\\n\", \"Create table If Not Exists Product (product_id int, description varchar(30), price int)\\n\", \"Create table If Not Exists Orders (order_id int, customer_id int, product_id int, order_date date, quantity int)\"], \"database_schema\": {\"Customers\": {\"customer_id\": \"INT\", \"name\": \"VARCHAR(30)\", \"country\": \"VARCHAR(30)\"}, \"Product\": {\"product_id\": \"INT\", \"description\": \"VARCHAR(30)\", \"price\": \"INT\"}, \"Orders\": {\"order_id\": \"INT\", \"customer_id\": \"INT\", \"product_id\": \"INT\", \"order_date\": \"DATE\", \"quantity\": \"INT\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Customers (customer_id int, name varchar(30), country varchar(30))", "Create table If Not Exists Product (product_id int, description varchar(30), price int)\n", "Create table If Not Exists Orders (order_id int, customer_id int, product_id int, order_date date, quantity int)\n", "Truncate table Customers", "insert into Customers (customer_id, name, country) values ('1', 'Winston', 'USA')", "insert into Customers (customer_id, name, country) values ('2', 'Jonathan', 'Peru')", "insert into Customers (customer_id, name, country) values ('3', 'Moustafa', 'Egypt')", "Truncate table Product", "insert into Product (product_id, description, price) values ('10', 'LC Phone', '300')", "insert into Product (product_id, description, price) values ('20', 'LC T-Shirt', '10')", "insert into Product (product_id, description, price) values ('30', 'LC Book', '45')", "insert into Product (product_id, description, price) values ('40', 'LC Keychain', '2')", "Truncate table Orders", "insert into Orders (order_id, customer_id, product_id, order_date, quantity) values ('1', '1', '10', '2020-06-10', '1')", "insert into Orders (order_id, customer_id, product_id, order_date, quantity) values ('2', '1', '20', '2020-07-01', '1')", "insert into Orders (order_id, customer_id, product_id, order_date, quantity) values ('3', '1', '30', '2020-07-08', '2')", "insert into Orders (order_id, customer_id, product_id, order_date, quantity) values ('4', '2', '10', '2020-06-15', '2')", "insert into Orders (order_id, customer_id, product_id, order_date, quantity) values ('5', '2', '40', '2020-07-01', '10')", "insert into Orders (order_id, customer_id, product_id, order_date, quantity) values ('6', '3', '20', '2020-06-24', '2')", "insert into Orders (order_id, customer_id, product_id, order_date, quantity) values ('7', '3', '30', '2020-06-25', '2')", "insert into Orders (order_id, customer_id, product_id, order_date, quantity) values ('9', '3', '30', '2020-05-08', '3')" ], "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" } } }