SQL is the dominant technology for accessing application data. It is increasingly becoming a performance bottleneck when it comes to scalability. Given its dominance, SQL is a crucial skill for all engineers.
An aggregate function is typically used in database queries to group together multiple rows to form a single value of meaningful data. A good programmer should be skilled at using data aggregation functions when interacting with databases.
Public questions (free account) are common interview questions. They are great for practicing, or if you want to filter candidates using the classic problems.
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.
- Example case: Wrong answer
- Users with several sessions: Wrong answer
- Various users: Wrong answer