- 쿼리의 품질(quality)과 나쁜 쿼리의 비율(poor_query_percentage) 출력
- query_name,quality,poor_query_percentage 출력
- 3자리에서 반올림
SELECT query_name,
ROUND(SUM(rating/position)/COUNT(*),2) AS quality,
ROUND(SUM(CASE WHEN rating<3 THEN 1 ELSE 0 END)/COUNT(*)*100,2)
AS poor_query_percentage
FROM Queries
GROUP BY query_name