{ "data": { "question": { "questionId": "2194", "questionFrontendId": "2051", "boundTopicId": null, "title": "The Category of Each Member in the Store", "titleSlug": "the-category-of-each-member-in-the-store", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Medium", "likes": 53, "dislikes": 7, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\":{\"Members\":[\"member_id\",\"name\"],\"Visits\":[\"visit_id\",\"member_id\",\"visit_date\"],\"Purchases\":[\"visit_id\",\"charged_amount\"]},\"rows\":{\"Members\":[[9,\"Alice\"],[11,\"Bob\"],[3,\"Winston\"],[8,\"Hercy\"],[1,\"Narihan\"]],\"Visits\":[[22,11,\"2021-10-28\"],[16,11,\"2021-01-12\"],[18,9,\"2021-12-10\"],[19,3,\"2021-10-19\"],[12,11,\"2021-03-01\"],[17,8,\"2021-05-07\"],[21,9,\"2021-05-12\"]],\"Purchases\":[[12,2000],[18,9000],[17,7000]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"6.7K\", \"totalSubmission\": \"9.7K\", \"totalAcceptedRaw\": 6703, \"totalSubmissionRaw\": 9697, \"acRate\": \"69.1%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"Members\":[\"member_id\",\"name\"],\"Visits\":[\"visit_id\",\"member_id\",\"visit_date\"],\"Purchases\":[\"visit_id\",\"charged_amount\"]},\"rows\":{\"Members\":[[9,\"Alice\"],[11,\"Bob\"],[3,\"Winston\"],[8,\"Hercy\"],[1,\"Narihan\"]],\"Visits\":[[22,11,\"2021-10-28\"],[16,11,\"2021-01-12\"],[18,9,\"2021-12-10\"],[19,3,\"2021-10-19\"],[12,11,\"2021-03-01\"],[17,8,\"2021-05-07\"],[21,9,\"2021-05-12\"]],\"Purchases\":[[12,2000],[18,9000],[17,7000]]}}", "metaData": "{\"mysql\": [\"Create table If Not Exists Members (member_id int, name varchar(30))\", \"Create table If Not Exists Visits (visit_id int, member_id int, visit_date date)\", \"Create table If Not Exists Purchases (visit_id int, charged_amount int)\"], \"mssql\": [\"Create table Members (member_id int, name varchar(30))\", \"Create table Visits (visit_id int, member_id int, visit_date date)\", \"Create table Purchases (visit_id int, charged_amount int)\"], \"oraclesql\": [\"Create table Members (member_id int, name varchar(30))\", \"Create table Visits (visit_id int, member_id int, visit_date date)\", \"Create table Purchases (visit_id int, charged_amount int)\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"], \"database\": true, \"name\": \"find_categories\", \"pythondata\": [\"Members = pd.DataFrame([], columns=['member_id', 'name']).astype({'member_id':'Int64', 'name':'object'})\", \"Visits = pd.DataFrame([], columns=['visit_id', 'member_id', 'visit_date']).astype({'visit_id':'Int64', 'member_id':'Int64', 'visit_date':'datetime64[ns]'})\", \"Purchases = pd.DataFrame([], columns=['visit_id', 'charged_amount']).astype({'visit_id':'Int64', 'charged_amount':'Int64'})\"], \"postgresql\": [\"Create table If Not Exists Members (member_id int, name varchar(30))\", \"Create table If Not Exists Visits (visit_id int, member_id int, visit_date date)\", \"Create table If Not Exists Purchases (visit_id int, charged_amount int)\"], \"database_schema\": {\"Members\": {\"member_id\": \"INT\", \"name\": \"VARCHAR(30)\"}, \"Visits\": {\"visit_id\": \"INT\", \"member_id\": \"INT\", \"visit_date\": \"DATE\"}, \"Purchases\": {\"visit_id\": \"INT\", \"charged_amount\": \"INT\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Members (member_id int, name varchar(30))", "Create table If Not Exists Visits (visit_id int, member_id int, visit_date date)", "Create table If Not Exists Purchases (visit_id int, charged_amount int)", "Truncate table Members", "insert into Members (member_id, name) values ('9', 'Alice')", "insert into Members (member_id, name) values ('11', 'Bob')", "insert into Members (member_id, name) values ('3', 'Winston')", "insert into Members (member_id, name) values ('8', 'Hercy')", "insert into Members (member_id, name) values ('1', 'Narihan')", "Truncate table Visits", "insert into Visits (visit_id, member_id, visit_date) values ('22', '11', '2021-10-28')", "insert into Visits (visit_id, member_id, visit_date) values ('16', '11', '2021-01-12')", "insert into Visits (visit_id, member_id, visit_date) values ('18', '9', '2021-12-10')", "insert into Visits (visit_id, member_id, visit_date) values ('19', '3', '2021-10-19')", "insert into Visits (visit_id, member_id, visit_date) values ('12', '11', '2021-03-01')", "insert into Visits (visit_id, member_id, visit_date) values ('17', '8', '2021-05-07')", "insert into Visits (visit_id, member_id, visit_date) values ('21', '9', '2021-05-12')", "Truncate table Purchases", "insert into Purchases (visit_id, charged_amount) values ('12', '2000')", "insert into Purchases (visit_id, charged_amount) values ('18', '9000')", "insert into Purchases (visit_id, charged_amount) values ('17', '7000')" ], "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" } } }