Challenge: Optimizing a Ratings Analysis Query
Swipe to start coding
You are tasked with analyzing and optimizing a query that aggregates driver ratings and ride statistics. The goal is to improve the performance of a query that calculates, for each driver, the total number of rides and their average rating.
- Use EXPLAIN to analyze the original query's execution plan.
- Write and include an optimized query for better performance, using the available tables and data. You must provide the optimized query solution code; if it is missing or incomplete, the task will not pass.
- Your optimized query must return, for each driver, their
driver_id,first_name,last_name, the total number of rides (total_rides), and their average rating (avg_rating). - Ensure that drivers with no rides or ratings still appear in the results, with
total_ridesandavg_ratingas zero. - Use EXPLAIN to show the execution plan of your optimized query.
- The test will fail if your solution does not include a complete and correct optimized query.
Oplossing
Bedankt voor je feedback!
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Can you explain this in simpler terms?
What are the next steps I should take?
Can you provide an example?
Geweldig!
Completion tarief verbeterd naar 4.76
Challenge: Optimizing a Ratings Analysis Query
Veeg om het menu te tonen
Swipe to start coding
You are tasked with analyzing and optimizing a query that aggregates driver ratings and ride statistics. The goal is to improve the performance of a query that calculates, for each driver, the total number of rides and their average rating.
- Use EXPLAIN to analyze the original query's execution plan.
- Write and include an optimized query for better performance, using the available tables and data. You must provide the optimized query solution code; if it is missing or incomplete, the task will not pass.
- Your optimized query must return, for each driver, their
driver_id,first_name,last_name, the total number of rides (total_rides), and their average rating (avg_rating). - Ensure that drivers with no rides or ratings still appear in the results, with
total_ridesandavg_ratingas zero. - Use EXPLAIN to show the execution plan of your optimized query.
- The test will fail if your solution does not include a complete and correct optimized query.
Oplossing
Bedankt voor je feedback!
single