Delete duplicates keeping the latest

SQL Medium 3 views
Back to Questions

Problem Description

In LoginLogs(user_id, logged_at, ip_address), remove duplicates where same user_id and ip_address appear multiple times on same day; keep the latest logged_at.

Input Format

SQL DML

Output Format

DML statement(s)

Sample Test Case

Input:
LoginLogs
Output:
Duplicates removed

Constraints

Use window function

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next