{ "data": { "question": { "questionId": "3473", "questionFrontendId": "3166", "boundTopicId": null, "title": "Calculate Parking Fees and Duration", "titleSlug": "calculate-parking-fees-and-duration", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Medium", "likes": 4, "dislikes": 1, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\":{\"ParkingTransactions\":[\"lot_id\",\"car_id\",\"entry_time\",\"exit_time\",\"fee_paid\"]},\"rows\":{\"ParkingTransactions\":[[1,1001,\"2023-06-01 08:00:00\",\"2023-06-01 10:30:00\",5.00],[1,1001,\"2023-06-02 11:00:00\",\"2023-06-02 12:45:00\",3.00],[2,1001,\"2023-06-01 10:45:00\",\"2023-06-01 12:00:00\",6.00],[2,1002,\"2023-06-01 09:00:00\",\"2023-06-01 11:30:00\",4.00],[3,1001,\"2023-06-03 07:00:00\",\"2023-06-03 09:00:00\",4.00],[3,1002,\"2023-06-02 12:00:00\",\"2023-06-02 14:00:00\",2.00]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"377\", \"totalSubmission\": \"631\", \"totalAcceptedRaw\": 377, \"totalSubmissionRaw\": 631, \"acRate\": \"59.7%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"ParkingTransactions\":[\"lot_id\",\"car_id\",\"entry_time\",\"exit_time\",\"fee_paid\"]},\"rows\":{\"ParkingTransactions\":[[1,1001,\"2023-06-01 08:00:00\",\"2023-06-01 10:30:00\",5.00],[1,1001,\"2023-06-02 11:00:00\",\"2023-06-02 12:45:00\",3.00],[2,1001,\"2023-06-01 10:45:00\",\"2023-06-01 12:00:00\",6.00],[2,1002,\"2023-06-01 09:00:00\",\"2023-06-01 11:30:00\",4.00],[3,1001,\"2023-06-03 07:00:00\",\"2023-06-03 09:00:00\",4.00],[3,1002,\"2023-06-02 12:00:00\",\"2023-06-02 14:00:00\",2.00]]}}", "metaData": "{\"mysql\": [\"CREATE TABLE If not exists ParkingTransactions (\\n lot_id INT,\\n car_id INT,\\n entry_time DATETIME,\\n exit_time DATETIME,\\n fee_paid DECIMAL(10, 2)\\n)\\n\"], \"mssql\": [\"CREATE TABLE ParkingTransactions (\\n lot_id INT,\\n car_id INT,\\n entry_time DATETIME,\\n exit_time DATETIME,\\n fee_paid DECIMAL(10, 2)\\n);\\n\"], \"oraclesql\": [\"CREATE TABLE ParkingTransactions (\\n lot_id NUMBER,\\n car_id NUMBER,\\n entry_time DATE,\\n exit_time DATE,\\n fee_paid NUMBER(10, 2)\\n)\\n\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'\"], \"database\": true, \"name\": \"calculate_fees_and_duration\", \"postgresql\": [\"CREATE TABLE IF NOT EXISTS ParkingTransactions (\\n lot_id INTEGER,\\n car_id INTEGER,\\n entry_time TIMESTAMP,\\n exit_time TIMESTAMP,\\n fee_paid NUMERIC(10, 2)\\n);\"], \"pythondata\": [\"ParkingTransactions = pd.DataFrame([], columns=['lot_id', 'car_id', 'entry_time', 'exit_time', 'fee_paid']).astype({\\n 'lot_id': 'Int64',\\n 'car_id': 'Int64',\\n 'entry_time': 'datetime64[ns]',\\n 'exit_time': 'datetime64[ns]',\\n 'fee_paid': 'float64'\\n})\"], \"database_schema\": {\"ParkingTransactions\": {\"lot_id\": \"INT\", \"car_id\": \"INT\", \"entry_time\": \"DATETIME\", \"exit_time\": \"DATETIME\", \"fee_paid\": \"DECIMAL(10, 2)\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "CREATE TABLE If not exists ParkingTransactions (\n lot_id INT,\n car_id INT,\n entry_time DATETIME,\n exit_time DATETIME,\n fee_paid DECIMAL(10, 2)\n)\n", "Truncate table ParkingTransactions", "insert into ParkingTransactions (lot_id, car_id, entry_time, exit_time, fee_paid) values ('1', '1001', '2023-06-01 08:00:00', '2023-06-01 10:30:00', '5.0')", "insert into ParkingTransactions (lot_id, car_id, entry_time, exit_time, fee_paid) values ('1', '1001', '2023-06-02 11:00:00', '2023-06-02 12:45:00', '3.0')", "insert into ParkingTransactions (lot_id, car_id, entry_time, exit_time, fee_paid) values ('2', '1001', '2023-06-01 10:45:00', '2023-06-01 12:00:00', '6.0')", "insert into ParkingTransactions (lot_id, car_id, entry_time, exit_time, fee_paid) values ('2', '1002', '2023-06-01 09:00:00', '2023-06-01 11:30:00', '4.0')", "insert into ParkingTransactions (lot_id, car_id, entry_time, exit_time, fee_paid) values ('3', '1001', '2023-06-03 07:00:00', '2023-06-03 09:00:00', '4.0')", "insert into ParkingTransactions (lot_id, car_id, entry_time, exit_time, fee_paid) values ('3', '1002', '2023-06-02 12:00:00', '2023-06-02 14:00:00', '2.0')" ], "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" } } }