求每位同学考试成绩90分以上的优秀率

 SELECT student_id,ROUND(AVG(score>90),2)
 FROM `score`
 GROUP BY `student_id`

求每日的乘客取消率

select t.Request_at as `Day`,
(
    round(avg(Status!=\'completed\'),2)
) as `Cancellation Rate`
from
    Users u inner join Trips t
on
    u.Users_id = t.Client_Id
where u.Banned=\'No\'
and t.Request_at >=\'2013-10-01\'
and t.Request_at <=\'2013-10-03\'
group by t.Request_at

版权声明:本文为alidata原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/alidata/p/13529049.html