0% found this document useful (0 votes)
55 views1 page

Query Quality Example

The document defines query quality as the average ratio of query rating to its position and poor query percentage as the percentage of queries rated less than 3. It outlines a solution to calculate each query's name along with its quality and poor query percentage, both rounded to two decimal places. The result table can be returned in any order.

Uploaded by

ninaddongre1516
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views1 page

Query Quality Example

The document defines query quality as the average ratio of query rating to its position and poor query percentage as the percentage of queries rated less than 3. It outlines a solution to calculate each query's name along with its quality and poor query percentage, both rounded to two decimal places. The result table can be returned in any order.

Uploaded by

ninaddongre1516
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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 |

+------------+-------------------+----------+--------+

You might also like