{ "data": { "question": { "questionId": "3097", "questionFrontendId": "2837", "categoryTitle": "Database", "boundTopicId": 2415741, "title": "Total Traveled Distance", "titleSlug": "total-traveled-distance", "content": null, "translatedTitle": "总旅行距离", "translatedContent": null, "isPaidOnly": true, "difficulty": "Easy", "likes": 0, "dislikes": 0, "isLiked": null, "similarQuestions": "[]", "contributors": [], "langToValidPlayground": null, "topicTags": [ { "name": "Database", "slug": "database", "translatedName": "数据库", "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"280\", \"totalSubmission\": \"394\", \"totalAcceptedRaw\": 280, \"totalSubmissionRaw\": 394, \"acRate\": \"71.1%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"Users\":[\"user_id\",\"name\"],\"Rides\":[\"ride_id\",\"user_id\",\"distance\"]},\"rows\":{\"Users\":[[17,\"Addison\"],[14,\"Ethan\"],[4,\"Michael\"],[2,\"Avery\"],[10,\"Eleanor\"]],\"Rides\":[[72,17,160],[42,14,161],[45,4,59],[32,2,197],[15,4,357],[56,2,196],[10,14,25]]}}", "metaData": "{\"mysql\":[\"Create table if not exists Users(user_id int, name varchar(30))\",\"Create table if not exists Rides(ride_id int,user_id int, distance int)\"],\"mssql\":[\"Create table Users(user_id int, name varchar(30))\",\"Create table Rides(ride_id int,user_id int, distance int)\"],\"oraclesql\":[\"Create table Users(user_id int, name varchar(30))\",\"Create table Rides(ride_id int,user_id int, distance int)\"],\"database\":true,\"name\":\"get_total_distance\",\"pythondata\":[\"Users = pd.DataFrame([], columns=['user_id', 'name']).astype({'user_id':'Int64', 'name':'object'})\",\"Rides = pd.DataFrame([], columns=['ride_id', 'user_id', 'distance']).astype({'ride_id':'Int64', 'user_id':'Int64', 'distance':'Int64'})\"],\"postgresql\":[\"Create table if not exists Users(user_id int, name varchar(30))\",\"Create table if not exists Rides(ride_id int,user_id int, distance int)\"],\"database_schema\":{\"Users\":{\"user_id\":\"INT\",\"name\":\"VARCHAR(30)\"},\"Rides\":{\"ride_id\":\"INT\",\"user_id\":\"INT\",\"distance\":\"INT\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table if not exists Users(user_id int, name varchar(30))", "Create table if not exists Rides(ride_id int,user_id int, distance int)", "Truncate table Users", "insert into Users (user_id, name) values ('17', 'Addison')", "insert into Users (user_id, name) values ('14', 'Ethan')", "insert into Users (user_id, name) values ('4', 'Michael')", "insert into Users (user_id, name) values ('2', 'Avery')", "insert into Users (user_id, name) values ('10', 'Eleanor')", "Truncate table Rides", "insert into Rides (ride_id, user_id, distance) values ('72', '17', '160')", "insert into Rides (ride_id, user_id, distance) values ('42', '14', '161')", "insert into Rides (ride_id, user_id, distance) values ('45', '4', '59')", "insert into Rides (ride_id, user_id, distance) values ('32', '2', '197')", "insert into Rides (ride_id, user_id, distance) values ('15', '4', '357')", "insert into Rides (ride_id, user_id, distance) values ('56', '2', '196')", "insert into Rides (ride_id, user_id, distance) values ('10', '14', '25')" ], "enableRunCode": true, "envInfo": "{\"mysql\":[\"MySQL\",\"
\\u7248\\u672c\\uff1a 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\":{\"Users\":[\"user_id\",\"name\"],\"Rides\":[\"ride_id\",\"user_id\",\"distance\"]},\"rows\":{\"Users\":[[17,\"Addison\"],[14,\"Ethan\"],[4,\"Michael\"],[2,\"Avery\"],[10,\"Eleanor\"]],\"Rides\":[[72,17,160],[42,14,161],[45,4,59],[32,2,197],[15,4,357],[56,2,196],[10,14,25]]}}",
"__typename": "QuestionNode"
}
}
}MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"