{ "data": { "question": { "questionId": "3340", "questionFrontendId": "3056", "boundTopicId": null, "title": "Snaps Analysis", "titleSlug": "snaps-analysis", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Medium", "likes": 0, "dislikes": 1, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\":{\"Activities\":[\"activity_id\",\"user_id\",\"activity_type\",\"time_spent\"],\"Age\":[\"user_id\",\"age_bucket\"]},\"rows\":{\"Activities\":[[7274,123,\"open\",4.50],[2425,123,\"send\",3.50],[1413,456,\"send\",5.67],[2536,456,\"open\",3.00],[8564,456,\"send\",8.24],[5235,789,\"send\",6.24],[4251,123,\"open\",1.25],[1435,789,\"open\",5.25]],\"Age\":[[123,\"31-35\"],[789,\"21-25\"],[456,\"26-30\"]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"157\", \"totalSubmission\": \"228\", \"totalAcceptedRaw\": 157, \"totalSubmissionRaw\": 228, \"acRate\": \"68.9%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"Activities\":[\"activity_id\",\"user_id\",\"activity_type\",\"time_spent\"],\"Age\":[\"user_id\",\"age_bucket\"]},\"rows\":{\"Activities\":[[7274,123,\"open\",4.50],[2425,123,\"send\",3.50],[1413,456,\"send\",5.67],[2536,456,\"open\",3.00],[8564,456,\"send\",8.24],[5235,789,\"send\",6.24],[4251,123,\"open\",1.25],[1435,789,\"open\",5.25]],\"Age\":[[123,\"31-35\"],[789,\"21-25\"],[456,\"26-30\"]]}}", "metaData": "{\"mysql\": [\"Create table if Not Exists Activities(activity_id int, user_id int, activity_type ENUM('send', 'open'), time_spent decimal(5,2))\", \"Create table if not Exists Age( user_id int, age_bucket ENUM('21-25','26-30','31-35'))\"], \"mssql\": [\"Create table Activities (activity_id int, user_id int, activity_type varchar(30) NOT NULL CHECK (activity_type IN ('send','open')), time_spent decimal(5,2))\", \"Create table Age( user_id int, age_bucket varchar(30) NOT NULL CHECK ( age_bucket IN ('21-25','26-30','31-35')))\"], \"oraclesql\": [\"Create table Activities (activity_id int, user_id int, activity_type varchar(30) NOT NULL CHECK (activity_type IN ('send','open')), time_spent decimal(5,2))\", \"Create table Age( user_id int, age_bucket varchar(30) NOT NULL CHECK ( age_bucket IN ('21-25','26-30','31-35')))\"], \"database\": true, \"name\": \"snap_analysis\", \"pythondata\": [\"Activities = pd.DataFrame([], columns=['activity_id', 'user_id', 'activity_type', 'time_spent']).astype({'activity_id':'Int64', 'user_id':'Int64', 'activity_type':'object', 'time_spent':'Float64'})\\n\", \"Age = pd.DataFrame([], columns=['user_id', 'age_bucket']).astype({'user_id':'Int64', 'age_bucket':'object'})\\n\"], \"postgresql\": [\"CREATE TABLE Activities (\\n activity_id SERIAL PRIMARY KEY,\\n user_id INT,\\n activity_type VARCHAR(30) NOT NULL CHECK (activity_type IN ('send', 'open')),\\n time_spent DECIMAL(5,2)\\n);\", \"CREATE TABLE Age (\\n user_id INT,\\n age_bucket VARCHAR(30) NOT NULL CHECK (age_bucket IN ('21-25', '26-30', '31-35'))\\n);\"], \"database_schema\": {\"Activities\": {\"activity_id\": \"INT\", \"user_id\": \"INT\", \"activity_type\": \"ENUM('send', 'open')\", \"time_spent\": \"DECIMAL(5, 2)\"}, \"Age\": {\"user_id\": \"INT\", \"age_bucket\": \"ENUM('21-25', '26-30', '31-35')\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table if Not Exists Activities(activity_id int, user_id int, activity_type ENUM('send', 'open'), time_spent decimal(5,2))", "Create table if not Exists Age( user_id int, age_bucket ENUM('21-25','26-30','31-35'))", "Truncate table Activities", "insert into Activities (activity_id, user_id, activity_type, time_spent) values ('7274', '123', 'open', '4.5')", "insert into Activities (activity_id, user_id, activity_type, time_spent) values ('2425', '123', 'send', '3.5')", "insert into Activities (activity_id, user_id, activity_type, time_spent) values ('1413', '456', 'send', '5.67')", "insert into Activities (activity_id, user_id, activity_type, time_spent) values ('2536', '456', 'open', '3.0')", "insert into Activities (activity_id, user_id, activity_type, time_spent) values ('8564', '456', 'send', '8.24')", "insert into Activities (activity_id, user_id, activity_type, time_spent) values ('5235', '789', 'send', '6.24')", "insert into Activities (activity_id, user_id, activity_type, time_spent) values ('4251', '123', 'open', '1.25')", "insert into Activities (activity_id, user_id, activity_type, time_spent) values ('1435', '789', 'open', '5.25')", "Truncate table Age", "insert into Age (user_id, age_bucket) values ('123', '31-35')", "insert into Age (user_id, age_bucket) values ('789', '21-25')", "insert into Age (user_id, age_bucket) values ('456', '26-30')" ], "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" } } }