Back to problems

Write SQL for active counts and YTD top driver

SQL · Uber · Medium

You are given three tables that back a ride-hailing platform: users, trips, and city. Write PostgreSQL queries for the two requests below. (a) Report how many riders and how many drivers are currently active. A user counts as active exactly when users.is_active = 1. The result must be a single row containing the columns active_riders and active_drivers. (b) Determine which driver has collected the largest amount of revenue from completed trips during the year-to-date (YTD)…

Checking your access…