bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 1211. Queries Quality and Percentage

1211. Queries Quality and Percentage

Leetcode Solutions

Calculating Query Quality and Poor Query Percentage

  1. Select the query_name column to group the results by each query.
  2. Calculate the quality by averaging the ratio of rating to position for each query.
  3. Calculate the poor_query_percentage by summing the instances where rating is less than 3, dividing by the total count of queries for each query_name, and multiplying by 100 to get the percentage.
  4. Use the ROUND() function to format both quality and poor_query_percentage to two decimal places.
  5. Group the results by query_name using the GROUP BY clause.

erDiagram
    Queries {
        varchar query_name
        varchar result
        int position
        int rating
    }

Computing Query Quality and Poor Query Percentage with Conditional Aggregation

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...