下面的查询是找到有超过180条出边的机场,并返回它们的IATA码。
This next query finds all airports that have more than 180 outgoing routes and returns their IATA
codes.
 

 

 我们可以提高我们的查询一点让它的返回结果包含IATA代码和精确的出边的数量。有不同的方式可以达成这一目标,方法之一就是使用group步骤。

We could improve our query a bit to include the IATA code and the exact number of outgoing
routes in the returned result. There are a few different ways that we could do this. One way that is
quite convenient is to use group.
 

 

 笔者已经把结果按表格排列,这样更易读。

I have laid the results out in a grid to make them easier to read.

 我们可以再进一步地优化这个查询。这次结果是按照路径数量的降序排列的。注意用到了local来确保排序是应用到了group步骤生成的集合内容中。

We can add one further refinement to the query. This time the results are ordered by the number
or routes in descending order. Note the use of local to make sure that order is applied to the
contents of the collection that was generated by the group step.
 

 

 笔者再次把结果以表格形式呈现。

I have again laid the results out in a grid.
 

 

就像笔者在本书前边提到的,任意机场的出边和入边的数量不会总是相同的,这取决于航空公司如何运营他们的航线。下面的查询找到有超过400条路线(包括入边和出边)的机场。 

As I mentioned earlier in the book, the number of incoming and outgoing routes for any given
airport will not always be the same due to how airlines operate their flight routings. The query
below looks for any airports that have more than 400 total routes (inbound and outbound).
 

 

 

5.1.5.只有一条路径的机场 Airports with just one route
或许有点奇怪,有大量的机场它们只有一条路径。下面的查询找出来了有多少个机场属于这一类的。
There are, perhaps surprisingly, a large number of airports that only have one route. The query
below will figure out just how many fall into that category.

 

 

 

 

posted on 2022-04-26 20:05  bokeyuannicheng0000  阅读(13)  评论(0)    收藏  举报