Queries Quality and Percentage - LeetCode
Can you solve this real interview question? Queries Quality and Percentage - Table: Queries +-------------+---------+ | Column Name | Type | +-------------+---------+ | query_name | varchar | | result | varchar | | position | int | | rating | int | +------
leetcode.com
1
2
3
4
5
6
|
# Write your MySQL query statement below
select query_name
, round(avg(rating/position), 2) quality
, COALESCE(round(100*sum(case when rating<3 then 1 end)/count(query_name), 2), 0) poor_query_percentage
from Queries
group by query_name
|
cs |
반응형
'SQL' 카테고리의 다른 글
leetcode 185 department-top-three-salaries/description (0) | 2023.11.16 |
---|---|
leetcode 1731. The Number of Employees Which Report to Each Employee (0) | 2023.06.16 |
leetcode 619. Biggest Single Number (0) | 2023.06.09 |
leetcode 1517. Find Users With Valid E-Mails (0) | 2023.06.07 |
leetcode 1633. Percentage of Users Attended a Contest (0) | 2023.06.01 |
댓글