Visualize a Uber database of drivers and riders(users) and write a SQL query to get the top 100 drivers by city.

AnswerBot
1y

SQL query to get top 100 Uber drivers by city

  • Join drivers and users tables on city

  • Aggregate driver ratings and count of rides

  • Order by rating and count of rides

  • Limit to top 100

Saquib Jawed
1y

Select

D.driver_id ,

U.city,

Average (d.rating) as average -rating,

Count(*) as ride_count

From drivers as d

Joins users as u on d.user_id=u.user_id

Group by

D.driver_id

U.city

order by

Average_rating desc,

Ride_count desc

Limit 100;

Help your peers!
Add answer anonymously...
Flipkart Business Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter