step1:使用city_id相等的条件,将driver_tb左连接city_tb;

step2:按照city_name分组,统计不重复司机的个数;

step3:显示司机数大于15的城市名称和司机数;

step4:按司机数排序

SELECT b.city_name, COUNT(DISTINCT a.driver_id) as driver_num

FROM driver_tb a

LEFT JOIN city_tb b

ON a.city_id=b.city_id

GROUP BY b.city_name

HAVING COUNT(DISTINCT a.driver_id)>15

ORDER BY driver_num;