We define query quality as:
The average of the ratio between query rating and its position.
We also define poor query percentage as:
The percentage of all queries with rating less than 3.
Write a solution to find each query_name, the quality and poor_query_percentage.
Both quality and poor_query_percentage should be rounded to 2 decimal places.
Return the result table in any order.
Example 1:
Input:
Queries table:
+------------+-------------------+----------+--------+
| query_name | result | position | rating |
+------------+-------------------+----------+--------+
| Dog | Golden Retriever | 1 |5 |
| Dog | German Shepherd | 2 |5 |
| Dog | Mule | 200 |1 |
| Cat | Shirazi |5 |2 |
| Cat | Siamese |3 |3 |
| Cat | Sphynx |7 |4 |
+------------+-------------------+----------+--------+