LeetCode(数据库)- The Airport With the Most Traffic

Posted 程序员牧码

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode(数据库)- The Airport With the Most Traffic相关的知识,希望对你有一定的参考价值。

题目链接:点击打开链接

题目大意:略。

解题思路:略。

AC 代码

WITH t AS(SELECT departure_airport id, flights_count cnt FROM Flights
UNION ALL
SELECT arrival_airport, flights_count FROM Flights),

tt AS(SELECT id, RANK() OVER(ORDER BY SUM(cnt) DESC) rk
FROM t
GROUP BY 1)

SELECT id airport_id
FROM tt
WHERE rk = 1

以上是关于LeetCode(数据库)- The Airport With the Most Traffic的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company

LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company

LeetCode(数据库)- Build the Equation

LeetCode(数据库)- Build the Equation

LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company II

LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company II