Grokking SQL for Tech Interviews
Vote

0% completed

8. Game Play Analysis II

Problem

Table: Activity

+--------------+---------+
| Column Name  | Type    |
+--------------+---------+
| player_id    | int     |
| device_id    | int     |
| event_date   | date    |
| games_played | int     |
+--------------+---------+
(player_id, event_date) is the primary key (combination of columns with unique values) of this table.
This table shows the activity of players of some games.
Each row is a record of a player who logged in and played a number of games (possibly 0) before logging out on someday using some device.

.....

.....

.....

Like the course? Get enrolled and start learning!
Loveqush Chaudhary

Loveqush Chaudhary

· 3 months ago

why is this query incorrect?

select a1.player_id , a1.device_id

from Activity a1

where

a1.event_date = (

select min(a2.event_date)

          from Activity a2

            where 

              a1.player_id = a2.player_id

            )

Reading Progress

0%