Sessions


SQL Aggregation Public

Hard  

7min

App usage data are kept in the following table:

TABLE sessions
  id INTEGER PRIMARY KEY,
  userId INTEGER NOT NULL,
  duration DECIMAL NOT NULL

Write a query that selects userId and average session duration for each user who has more than one session.

See the example case for more details.

SQLite 3.9.2
   

  •   Example case: Wrong answer
  •   Users with several sessions: Wrong answer
  •   Various users: Wrong answer