Skip to content

Instantly share code, notes, and snippets.

@LIQRGV
Created January 9, 2020 01:55
Show Gist options
  • Save LIQRGV/ab934071f6567bd20bd179f5be7ca4aa to your computer and use it in GitHub Desktop.
Save LIQRGV/ab934071f6567bd20bd179f5be7ca4aa to your computer and use it in GitHub Desktop.
--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.
--https://www.testdome.com/questions/sql/sessions/14245?visibility=1&skillId=17
select userId, avg(duration) from sessions group by userId having count(1) > 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment