Procedure to clean old logs
SQL
Easy
2 views
Problem Description
Create sp_delete_old_logs(p_days) that deletes from LoginLogs older than p_days.
Input Format
SQL procedure
Output Format
Procedure created
Sample Test Case
Input:
LoginLogs(logged_at)
Output:
Procedure created
Official Solution
CREATE PROCEDURE sp_delete_old_logs(IN p_days INT) BEGIN DELETE FROM LoginLogs WHERE logged_at < CURRENT_TIMESTAMP - INTERVAL p_days DAY; END;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!