SQL interview Questions – Leetcode 511 – Game Play Analysis I

Problem Description –

Write an SQL query that reports the first login date for each player.

The query result format is in the following example:

Difficulty Level – Easy

Solution –

SELECT 
    player_id,
    MIN(event_date) as first_login
FROM Activity
GROUP BY player_id

To get the result, we have to first group the data by each player using and then we have to use the MIN() function which we give us the first login date of each players.

Rating: 1 out of 5.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s