15 sql interview questions, asked at Meta, Airbnb, Notion and 3 more companies. Last asked Sep 2026.
Time on page from the next user eventCodingGiven a table of user events with timestamps, estimate how long each user stayed on each page as the time until that user's next event. Use LEAD() partitioned by user and ordered…
Last asked Sep 2026
Users with impressions on seven consecutive daysCodingFrom a table of user impressions with dates, find the users who had at least one impression on seven days in a row. Remove duplicate days per user, then use a window function (row…
Total population of a city across zip codes in SQLCodingFour tables describe geography: country, state, city and zip code, each pointing to its parent, and the population is stored per zip code. Write a query that returns the total…
Last asked Feb 2026
Table aggregation with group-by sumCodingAggregate table rows with a group-by sum over a chosen column, as a database table view would. Reported on 1point3acres' Notion bank; reconstructed in our own words.
Last asked Feb 2026
SQL: each user's first share and closest collaboratorCodingTables hold users, files and user actions on files. Write SQL that finds the first time each user shared a file, then a query for each user's closest collaborator, the person they…
Last asked Jan 2026
Car rental utilization by city (SQL)CodingGiven tables of rental cars and their rentals, write SQL that reports utilization per city: how much of the available fleet time in each city was actually rented over a period…
Customers who rented in two consecutive weeks (SQL)CodingAmong customers who made purchases in two consecutive full weeks of 2024, return the customer with the most copies rented in the first of those two weeks. Expect to extract the…
Last asked Sep 2025
Count active follow connections in SQLCodingA table records follow and unfollow events between users over time. Write SQL that returns the current number of active follow connections, taking each pair's latest event into…
Last asked Aug 2025
Carpool ride metrics in SQLCodingFor a ride-sharing product that lets riders share a car, write SQL over ride and request tables for a series of metrics, such as completed shared rides per day and averages per…
Last asked Aug 2025
Cumulative user metrics with a full outer joinCodingMaintain a cumulative table of per-user metrics day by day: combine yesterday's cumulative snapshot with today's activity using a full outer join, so users with no activity today…
Last asked Aug 2025
Top three items per category in SQLCodingFor content in many categories, return the top three items in each category by an engagement measure, handling ties deliberately. Use a ranking window function partitioned by…
Last asked Aug 2025
Unique users per activity and average time on siteCodingEach record captures one user's action on a website, with the user, the activity and the time. Write code that returns the number of unique users for each activity and the average…
Last asked May 2025
SQL screening with joins and window functionsCodingA SQL screen covering joins, aggregation and window functions over product data. Reported on 1point3acres' Notion bank; reconstructed in our own words.