{ "data": { "question": { "questionId": "1654", "questionFrontendId": "1511", "categoryTitle": "Database", "boundTopicId": 326422, "title": "Customer Order Frequency", "titleSlug": "customer-order-frequency", "content": null, "translatedTitle": "消费者下单频率", "translatedContent": null, "isPaidOnly": true, "difficulty": "Easy", "likes": 59, "dislikes": 0, "isLiked": null, "similarQuestions": "[]", "contributors": [], "langToValidPlayground": null, "topicTags": [ { "name": "Database", "slug": "database", "translatedName": "数据库", "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"10.1K\", \"totalSubmission\": \"15.7K\", \"totalAcceptedRaw\": 10113, \"totalSubmissionRaw\": 15675, \"acRate\": \"64.5%\"}", "hints": [], "solution": null, "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, "envInfo": "{\"mysql\":[\"MySQL\",\"

\\u7248\\u672c\\uff1aMySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"

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\": {\"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]]}}", "__typename": "QuestionNode" } } }