Malloy Documentation
search

A semantic data model contains prebuilt calculations and relationships for a set of data. This article will show you the basics of querying a semantic data model in Malloy.

Let’s start simply, we'll define: dimension, measure, aggregating query, and lookup query.

Data for Kindergarteners

Given that we learn about data in Kindergarten, it is really surprising how hard it is to query data in the "big" world. In kindergarten data, we notice attributes about things, make piles of things, and count things in the piles. We do this even before we learn any "real" math. Strangely, noticing attributes about things and counting things is almost all there is to working with data.

Two types of queries, "Where's Waldo" and "Making Piles"

There are really two types of queries in the world, lookup and aggregating.

Lookup queries are pretty easy. Google search is a lookup query. To search, type in some terms then see a list of results. Searching in SQL this often looks like SELECT * FROM <something> WHERE <FILTER>.

The interesting queries, the kindergarten queries, are aggregating. Aggregating queries tell you something about a set of data. An aggregating query has two main parts, the dimensions and measures.

Dimensions are the attributes you use to decide which pile the thing goes in.

A measure is something you can say about the pile. "How many objects?", "How much does this pile weigh?", "What is the average size of an object in this pile?"

"OK class, let's take this pile of coins and separate them. How many coins are pennies? How many coins are nickels? Dimes? Quarters?"

Aggregating queries tell us things about datasets. Lookup queries find things.

SQL World

In the SQL world, the interface to your data is just that, data. The data sits in tables. Everytime, you ask a question (run a query), you need to restate all the things about the data: the calculations, the relationships between tables. The unit of reusability is a table. You can run a query that makes a new table. You can turn a query into a SQL View, which is basically a table based on a calculation.

The Semantic Data Model is the interface to your data

In a Semantic Data Model, the calculations (dimensions and measures) are reusable. The join relationships are built into the semantic data model. The calculations (common ways of looking at data) are coded into the semantic data model. The act of querying becomes simply picking dimensions and measures, filtering the data, and sorting the results. This simplification is powerful in that the calculations are always vetted, so it becomes much harder to get incorrect results.

A Simple Example

Below is a semantic data model for some flight data. For now, let's not concern ourselves with how this model is built but instead focus on how we can ask questions of the model. In the semantic model, dimensions, measures, and joined relationships are all exposed as a list of variables.

Each flight has an origin, destination and carrier. Flights can be delayed. Each flight has an aircraft that made the flight, and more. The semantic data model provides us with the dimensions (in blue), the measures (in orange), and the graph of related objects. This model is encoded in a file called ‘flights.malloy’.

document
import {flights} from 'flights.malloy' 

Step 10: We'll jump to the end with a complex example

A semantic data model lets you do complicated things simply. Shamelessly, to ensure you read the full article, I'll start with a seemingly complex example and then explain how we got here. It's actually quite simple.

The dashboard below shows flights from airports in California, where you can go, and which carriers will take you there. It shows how this has changed over time.

document
# dashboard
run: flights -> origin_name + metrics + {
  where: origin.state = 'CA'
  nest: destination_name + metrics + carrier_list + {limit: 6} 
  # bar_chart
  nest: carrier_name + flight_count
  # line_chart
  nest: dep_month + flight_count 
}
QUERY RESULTS
origin_name
LAX - LOS ANGELES
flight_count
11,077
total_distance
12,861,847
percent_of_flights
27.24%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
LAS - LAS VEGAS1,073253,2289.69%Southwest, United, America West, American, Northwest, Delta
OAK - OAKLAND868292,5167.84%Southwest, United, American
PHX - PHOENIX737272,6906.65%Southwest, America West, United, American
IAD - WASHINGTON6151,407,1205.55%United, American
SEA - SEATTLE528503,7124.77%Alaska, United
ORD - CHICAGO523912,6354.72%United, American
carrier_name
SouthwestUnitedAmericanNorthwestAlaskaDeltaAmerica WestUSAirATAAmerican EagleContinentalContinental Expresscarrier_name01,0002,0003,0004,000flight_count
dep_month
200020012002200320042005dep_month100120140160180200220flight_count
origin_name
OAK - OAKLAND
flight_count
5,076
total_distance
3,472,237
percent_of_flights
12.48%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
LAX - LOS ANGELES792266,90415.6%Southwest, United, American
SAN - SAN DIEGO479213,6349.44%Southwest
SEA - SEATTLE472316,7129.3%Southwest, Alaska
ONT - ONTARIO433156,3138.53%Southwest
LAS - LAS VEGAS422171,7548.31%Southwest, America West
BUR - BURBANK405131,6257.98%Southwest
carrier_name
SouthwestJetblueUnitedAlaskaAmerica WestAmericanDeltaContinentalcarrier_name01,0002,0003,0004,000flight_count
dep_month
200020012002200320042005dep_month406080100flight_count
origin_name
SAN - SAN DIEGO
flight_count
5,075
total_distance
4,691,341
percent_of_flights
12.48%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
LAS - LAS VEGAS508131,06410.01%Southwest, America West
OAK - OAKLAND482214,9729.5%Southwest
PHX - PHOENIX476144,7049.38%Southwest, America West
ORD - CHICAGO468806,3649.22%United, American
SMF - SACRAMENTO428205,4408.43%Southwest
SJC - SAN JOSE423176,3918.33%Southwest, American
carrier_name
SouthwestUnitedAmericanAlaskaUSAirNorthwestDeltaAmerica WestJetblueContinentalcarrier_name05001,0001,5002,0002,5003,000flight_count
dep_month
200020012002200320042005dep_month405060708090100flight_count
origin_name
SFO - SAN FRANCISCO
flight_count
4,540
total_distance
6,391,762
percent_of_flights
11.16%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
LAS - LAS VEGAS431178,4349.49%United, America West
ORD - CHICAGO362668,2527.97%United, American
LAX - LOS ANGELES318107,1667%United, American, Alaska, Delta
DFW - DALLAS-FORT WORTH304445,0566.7%American, United, Delta
MSP - MINNEAPOLIS281446,5096.19%Northwest
PHX - PHOENIX259168,6095.7%United, America West, Southwest
carrier_name
UnitedAmericanNorthwestAlaskaAmerica WestUSAirDeltaSouthwestATAContinentalcarrier_name05001,0001,5002,0002,500flight_count
dep_month
200020012002200320042005dep_month405060708090flight_count
origin_name
SJC - SAN JOSE
flight_count
3,825
total_distance
2,826,646
percent_of_flights
9.4%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
LAX - LOS ANGELES475146,30012.42%Southwest, American
SEA - SEATTLE368256,4969.62%Alaska, Southwest, American
SAN - SAN DIEGO363151,3719.49%Southwest, American
PHX - PHOENIX314194,9948.21%Southwest, America West, American
LAS - LAS VEGAS303116,9587.92%Southwest, American, America West
BUR - BURBANK24071,0406.27%Southwest
carrier_name
SouthwestAmericanAlaskaUnitedAmerica WestNorthwestContinentalJetblueDeltaATAcarrier_name05001,0001,5002,000flight_count
dep_month
200020012002200320042005dep_month304050607080flight_count
origin_name
SMF - SACRAMENTO
flight_count
3,576
total_distance
2,367,376
percent_of_flights
8.79%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
PHX - PHOENIX479309,91313.39%America West, Southwest
SAN - SAN DIEGO396190,08011.07%Southwest
LAX - LOS ANGELES382142,48610.68%Southwest, United
ONT - ONTARIO380147,82010.63%Southwest
LAS - LAS VEGAS327129,8199.14%Southwest, America West
BUR - BURBANK27999,8827.8%Southwest
carrier_name
SouthwestAmerica WestUnitedAmericanAlaskaNorthwestDeltaContinentalJetbluecarrier_name05001,0001,5002,0002,500flight_count
dep_month
200020012002200320042005dep_month3040506070flight_count
origin_name
ONT - ONTARIO
flight_count
2,642
total_distance
1,492,508
percent_of_flights
6.5%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
PHX - PHOENIX491159,57518.58%Southwest, America West
SMF - SACRAMENTO412160,26815.59%Southwest
OAK - OAKLAND411148,37115.56%Southwest
LAS - LAS VEGAS34467,76813.02%Southwest, America West
SJC - SAN JOSE23678,5888.93%Southwest
SEA - SEATTLE145138,6205.49%Alaska
carrier_name
SouthwestAlaskaUnitedAmericanAmerica WestNorthwestJetblueDeltaContinentalContinental Expresscarrier_name05001,0001,5002,000flight_count
dep_month
200020012002200320042005dep_month2030405060flight_count
origin_name
BUR - BURBANK
flight_count
1,952
total_distance
876,479
percent_of_flights
4.8%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
LAS - LAS VEGAS38886,52419.88%Southwest, America West
OAK - OAKLAND367119,27518.8%Southwest
PHX - PHOENIX357131,73318.29%Southwest, America West
SMF - SACRAMENTO26093,08013.32%Southwest
SJC - SAN JOSE20660,97610.55%Southwest
SEA - SEATTLE154144,2987.89%Alaska
carrier_name
SouthwestAlaskaAmerica WestAmericanJetblueUnitedDeltacarrier_name05001,0001,500flight_count
dep_month
200020012002200320042005dep_month1520253035404550flight_count
origin_name
SNA - SANTA ANA
flight_count
1,919
total_distance
1,377,110
percent_of_flights
4.72%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
PHX - PHOENIX297100,38615.48%America West, Southwest
LAS - LAS VEGAS26058,76013.55%America West, Southwest, American, Delta
SMF - SACRAMENTO252101,80813.13%Southwest, America West
SFO - SAN FRANCISCO17765,8449.22%United, American
DEN - DENVER173146,3589.02%United
OAK - OAKLAND16059,3608.34%Southwest
carrier_name
SouthwestUnitedAmerica WestNorthwestUSAirAmericanDeltacarrier_name0100200300400500600700flight_count
dep_month
200020012002200320042005dep_month1020304050flight_count
origin_name
LGB - LONG BEACH
flight_count
661
total_distance
931,914
percent_of_flights
1.63%
destination_name
destination_​nameflight_​counttotal_​distancepercent_​of_​flightscl
JFK - NEW YORK149367,28522.54%Jetblue
OAK - OAKLAND11741,30117.7%Jetblue
DFW - DALLAS-FORT WORTH97118,34014.67%American
IAD - WASHINGTON77175,32911.65%Jetblue
LAS - LAS VEGAS5612,9368.47%Jetblue
PHX - PHOENIX5419,1708.17%America West
carrier_name
JetblueAmericanAmerica WestAlaskacarrier_name0100200300400500flight_count
dep_month
200020012002200320042005dep_month05101520253035flight_count
[
  {
    "origin_name": "LAX - LOS ANGELES",
    "flight_count": 11077,
    "total_distance": 12861847,
    "percent_of_flights": 0.2723629210720433,
    "destination_name": [
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 1073,
        "total_distance": 253228,
        "percent_of_flights": 0.09686738286539677,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 556
          },
          {
            "nickname": "United",
            "flight_count": 255
          },
          {
            "nickname": "America West",
            "flight_count": 136
          },
          {
            "nickname": "American",
            "flight_count": 82
          },
          {
            "nickname": "Northwest",
            "flight_count": 35
          },
          {
            "nickname": "Delta",
            "flight_count": 9
          }
        ]
      },
      {
        "destination_name": "OAK - OAKLAND",
        "flight_count": 868,
        "total_distance": 292516,
        "percent_of_flights": 0.07836056694050736,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 821
          },
          {
            "nickname": "United",
            "flight_count": 32
          },
          {
            "nickname": "American",
            "flight_count": 15
          }
        ]
      },
      {
        "destination_name": "PHX - PHOENIX",
        "flight_count": 737,
        "total_distance": 272690,
        "percent_of_flights": 0.06653426017874876,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 552
          },
          {
            "nickname": "America West",
            "flight_count": 159
          },
          {
            "nickname": "United",
            "flight_count": 15
          },
          {
            "nickname": "American",
            "flight_count": 11
          }
        ]
      },
      {
        "destination_name": "IAD - WASHINGTON",
        "flight_count": 615,
        "total_distance": 1407120,
        "percent_of_flights": 0.05552044777466823,
        "cl": [
          {
            "nickname": "United",
            "flight_count": 330
          },
          {
            "nickname": "American",
            "flight_count": 285
          }
        ]
      },
      {
        "destination_name": "SEA - SEATTLE",
        "flight_count": 528,
        "total_distance": 503712,
        "percent_of_flights": 0.047666335650446874,
        "cl": [
          {
            "nickname": "Alaska",
            "flight_count": 418
          },
          {
            "nickname": "United",
            "flight_count": 110
          }
        ]
      },
      {
        "destination_name": "ORD - CHICAGO",
        "flight_count": 523,
        "total_distance": 912635,
        "percent_of_flights": 0.047214949896181274,
        "cl": [
          {
            "nickname": "United",
            "flight_count": 382
          },
          {
            "nickname": "American",
            "flight_count": 141
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "Southwest",
        "flight_count": 4282
      },
      {
        "carrier_name": "United",
        "flight_count": 2319
      },
      {
        "carrier_name": "American",
        "flight_count": 1951
      },
      {
        "carrier_name": "Northwest",
        "flight_count": 993
      },
      {
        "carrier_name": "Alaska",
        "flight_count": 695
      },
      {
        "carrier_name": "Delta",
        "flight_count": 343
      },
      {
        "carrier_name": "America West",
        "flight_count": 295
      },
      {
        "carrier_name": "USAir",
        "flight_count": 135
      },
      {
        "carrier_name": "ATA",
        "flight_count": 32
      },
      {
        "carrier_name": "American Eagle",
        "flight_count": 25
      },
      {
        "carrier_name": "Continental",
        "flight_count": 6
      },
      {
        "carrier_name": "Continental Express",
        "flight_count": 1
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 165
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 182
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 163
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 154
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 171
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 175
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 148
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 138
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 146
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 139
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 124
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 146
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 127
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 169
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 152
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 157
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 136
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 153
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 163
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 133
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 140
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 144
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 139
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 126
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 142
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 135
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 131
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 141
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 151
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 137
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 135
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 157
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 162
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 152
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 173
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 180
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 164
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 154
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 160
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 164
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 172
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 132
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 166
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 140
      },
      {
        "dep_month": "2002-04-01T00:00:00.000Z",
        "flight_count": 105
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 130
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 129
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 125
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 141
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 124
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 142
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 135
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 169
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 136
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 160
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 159
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 174
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 152
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 161
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 168
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 156
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 160
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 172
      },
      {
        "dep_month": "2000-09-01T00:00:00.000Z",
        "flight_count": 156
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 221
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 180
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 155
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 183
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 172
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 196
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 189
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 189
      }
    ]
  },
  {
    "origin_name": "OAK - OAKLAND",
    "flight_count": 5076,
    "total_distance": 3472237,
    "percent_of_flights": 0.12480944184902877,
    "destination_name": [
      {
        "destination_name": "LAX - LOS ANGELES",
        "flight_count": 792,
        "total_distance": 266904,
        "percent_of_flights": 0.15602836879432624,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 745
          },
          {
            "nickname": "United",
            "flight_count": 36
          },
          {
            "nickname": "American",
            "flight_count": 11
          }
        ]
      },
      {
        "destination_name": "SAN - SAN DIEGO",
        "flight_count": 479,
        "total_distance": 213634,
        "percent_of_flights": 0.09436564223798266,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 479
          }
        ]
      },
      {
        "destination_name": "SEA - SEATTLE",
        "flight_count": 472,
        "total_distance": 316712,
        "percent_of_flights": 0.09298660362490149,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 271
          },
          {
            "nickname": "Alaska",
            "flight_count": 201
          }
        ]
      },
      {
        "destination_name": "ONT - ONTARIO",
        "flight_count": 433,
        "total_distance": 156313,
        "percent_of_flights": 0.08530338849487785,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 433
          }
        ]
      },
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 422,
        "total_distance": 171754,
        "percent_of_flights": 0.08313632781717888,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 382
          },
          {
            "nickname": "America West",
            "flight_count": 40
          }
        ]
      },
      {
        "destination_name": "BUR - BURBANK",
        "flight_count": 405,
        "total_distance": 131625,
        "percent_of_flights": 0.0797872340425532,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 405
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "Southwest",
        "flight_count": 3964
      },
      {
        "carrier_name": "Jetblue",
        "flight_count": 297
      },
      {
        "carrier_name": "United",
        "flight_count": 249
      },
      {
        "carrier_name": "Alaska",
        "flight_count": 245
      },
      {
        "carrier_name": "America West",
        "flight_count": 164
      },
      {
        "carrier_name": "American",
        "flight_count": 139
      },
      {
        "carrier_name": "Delta",
        "flight_count": 10
      },
      {
        "carrier_name": "Continental",
        "flight_count": 8
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 91
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 87
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 100
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 88
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 88
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 98
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 83
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 79
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 85
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 82
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 77
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 76
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 76
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 68
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 98
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 91
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 93
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 73
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 88
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 66
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 75
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 64
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 79
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 84
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 85
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 92
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 77
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 93
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 84
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 86
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 72
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 101
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 56
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 60
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 66
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 61
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 55
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2002-04-01T00:00:00.000Z",
        "flight_count": 63
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 50
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 55
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 81
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 65
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 63
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 65
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 47
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 80
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 43
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2000-09-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 45
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 52
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 63
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 57
      }
    ]
  },
  {
    "origin_name": "SAN - SAN DIEGO",
    "flight_count": 5075,
    "total_distance": 4691341,
    "percent_of_flights": 0.12478485370051635,
    "destination_name": [
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 508,
        "total_distance": 131064,
        "percent_of_flights": 0.10009852216748769,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 470
          },
          {
            "nickname": "America West",
            "flight_count": 38
          }
        ]
      },
      {
        "destination_name": "OAK - OAKLAND",
        "flight_count": 482,
        "total_distance": 214972,
        "percent_of_flights": 0.09497536945812808,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 482
          }
        ]
      },
      {
        "destination_name": "PHX - PHOENIX",
        "flight_count": 476,
        "total_distance": 144704,
        "percent_of_flights": 0.09379310344827586,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 400
          },
          {
            "nickname": "America West",
            "flight_count": 76
          }
        ]
      },
      {
        "destination_name": "ORD - CHICAGO",
        "flight_count": 468,
        "total_distance": 806364,
        "percent_of_flights": 0.09221674876847291,
        "cl": [
          {
            "nickname": "United",
            "flight_count": 251
          },
          {
            "nickname": "American",
            "flight_count": 217
          }
        ]
      },
      {
        "destination_name": "SMF - SACRAMENTO",
        "flight_count": 428,
        "total_distance": 205440,
        "percent_of_flights": 0.08433497536945812,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 428
          }
        ]
      },
      {
        "destination_name": "SJC - SAN JOSE",
        "flight_count": 423,
        "total_distance": 176391,
        "percent_of_flights": 0.08334975369458128,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 366
          },
          {
            "nickname": "American",
            "flight_count": 57
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "Southwest",
        "flight_count": 2865
      },
      {
        "carrier_name": "United",
        "flight_count": 641
      },
      {
        "carrier_name": "American",
        "flight_count": 589
      },
      {
        "carrier_name": "Alaska",
        "flight_count": 389
      },
      {
        "carrier_name": "USAir",
        "flight_count": 145
      },
      {
        "carrier_name": "Northwest",
        "flight_count": 138
      },
      {
        "carrier_name": "Delta",
        "flight_count": 135
      },
      {
        "carrier_name": "America West",
        "flight_count": 114
      },
      {
        "carrier_name": "Jetblue",
        "flight_count": 56
      },
      {
        "carrier_name": "Continental",
        "flight_count": 3
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 89
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 63
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 76
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 98
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 75
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 65
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 75
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 88
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 76
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 90
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 72
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 72
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 73
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 65
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 83
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 76
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 67
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 72
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 71
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 80
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 82
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 85
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 75
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 80
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 75
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 65
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 81
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 93
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 63
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 86
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 93
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 66
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 73
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 82
      },
      {
        "dep_month": "2002-04-01T00:00:00.000Z",
        "flight_count": 67
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 60
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 77
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 79
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 72
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 64
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 61
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 87
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 67
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 73
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 68
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 67
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 63
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 71
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2000-09-01T00:00:00.000Z",
        "flight_count": 68
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 76
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 71
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 61
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 71
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 58
      }
    ]
  },
  {
    "origin_name": "SFO - SAN FRANCISCO",
    "flight_count": 4540,
    "total_distance": 6391762,
    "percent_of_flights": 0.11163019424637324,
    "destination_name": [
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 431,
        "total_distance": 178434,
        "percent_of_flights": 0.09493392070484581,
        "cl": [
          {
            "nickname": "United",
            "flight_count": 299
          },
          {
            "nickname": "America West",
            "flight_count": 132
          }
        ]
      },
      {
        "destination_name": "ORD - CHICAGO",
        "flight_count": 362,
        "total_distance": 668252,
        "percent_of_flights": 0.07973568281938326,
        "cl": [
          {
            "nickname": "United",
            "flight_count": 282
          },
          {
            "nickname": "American",
            "flight_count": 80
          }
        ]
      },
      {
        "destination_name": "LAX - LOS ANGELES",
        "flight_count": 318,
        "total_distance": 107166,
        "percent_of_flights": 0.07004405286343612,
        "cl": [
          {
            "nickname": "United",
            "flight_count": 182
          },
          {
            "nickname": "American",
            "flight_count": 93
          },
          {
            "nickname": "Alaska",
            "flight_count": 40
          },
          {
            "nickname": "Delta",
            "flight_count": 3
          }
        ]
      },
      {
        "destination_name": "DFW - DALLAS-FORT WORTH",
        "flight_count": 304,
        "total_distance": 445056,
        "percent_of_flights": 0.06696035242290749,
        "cl": [
          {
            "nickname": "American",
            "flight_count": 252
          },
          {
            "nickname": "United",
            "flight_count": 50
          },
          {
            "nickname": "Delta",
            "flight_count": 2
          }
        ]
      },
      {
        "destination_name": "MSP - MINNEAPOLIS",
        "flight_count": 281,
        "total_distance": 446509,
        "percent_of_flights": 0.0618942731277533,
        "cl": [
          {
            "nickname": "Northwest",
            "flight_count": 281
          }
        ]
      },
      {
        "destination_name": "PHX - PHOENIX",
        "flight_count": 259,
        "total_distance": 168609,
        "percent_of_flights": 0.057048458149779734,
        "cl": [
          {
            "nickname": "United",
            "flight_count": 140
          },
          {
            "nickname": "America West",
            "flight_count": 78
          },
          {
            "nickname": "Southwest",
            "flight_count": 41
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "United",
        "flight_count": 2464
      },
      {
        "carrier_name": "American",
        "flight_count": 688
      },
      {
        "carrier_name": "Northwest",
        "flight_count": 522
      },
      {
        "carrier_name": "Alaska",
        "flight_count": 221
      },
      {
        "carrier_name": "America West",
        "flight_count": 210
      },
      {
        "carrier_name": "USAir",
        "flight_count": 157
      },
      {
        "carrier_name": "Delta",
        "flight_count": 134
      },
      {
        "carrier_name": "Southwest",
        "flight_count": 86
      },
      {
        "carrier_name": "ATA",
        "flight_count": 37
      },
      {
        "carrier_name": "Continental",
        "flight_count": 21
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 84
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 92
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 95
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 79
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 74
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 92
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 86
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 81
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 74
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 75
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 86
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 75
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 77
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 63
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 71
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 74
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 78
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 68
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 68
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 45
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 64
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 47
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 50
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 48
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 56
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 55
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 63
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 65
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2002-04-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 45
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 43
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 66
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 55
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 55
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 78
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 65
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2000-09-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 61
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 55
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 73
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 50
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 67
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 56
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 64
      }
    ]
  },
  {
    "origin_name": "SJC - SAN JOSE",
    "flight_count": 3825,
    "total_distance": 2826646,
    "percent_of_flights": 0.09404966805999508,
    "destination_name": [
      {
        "destination_name": "LAX - LOS ANGELES",
        "flight_count": 475,
        "total_distance": 146300,
        "percent_of_flights": 0.12418300653594772,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 419
          },
          {
            "nickname": "American",
            "flight_count": 56
          }
        ]
      },
      {
        "destination_name": "SEA - SEATTLE",
        "flight_count": 368,
        "total_distance": 256496,
        "percent_of_flights": 0.09620915032679739,
        "cl": [
          {
            "nickname": "Alaska",
            "flight_count": 240
          },
          {
            "nickname": "Southwest",
            "flight_count": 106
          },
          {
            "nickname": "American",
            "flight_count": 22
          }
        ]
      },
      {
        "destination_name": "SAN - SAN DIEGO",
        "flight_count": 363,
        "total_distance": 151371,
        "percent_of_flights": 0.09490196078431372,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 315
          },
          {
            "nickname": "American",
            "flight_count": 48
          }
        ]
      },
      {
        "destination_name": "PHX - PHOENIX",
        "flight_count": 314,
        "total_distance": 194994,
        "percent_of_flights": 0.08209150326797386,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 178
          },
          {
            "nickname": "America West",
            "flight_count": 123
          },
          {
            "nickname": "American",
            "flight_count": 13
          }
        ]
      },
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 303,
        "total_distance": 116958,
        "percent_of_flights": 0.0792156862745098,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 181
          },
          {
            "nickname": "American",
            "flight_count": 65
          },
          {
            "nickname": "America West",
            "flight_count": 57
          }
        ]
      },
      {
        "destination_name": "BUR - BURBANK",
        "flight_count": 240,
        "total_distance": 71040,
        "percent_of_flights": 0.06274509803921569,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 240
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "Southwest",
        "flight_count": 2148
      },
      {
        "carrier_name": "American",
        "flight_count": 562
      },
      {
        "carrier_name": "Alaska",
        "flight_count": 366
      },
      {
        "carrier_name": "United",
        "flight_count": 317
      },
      {
        "carrier_name": "America West",
        "flight_count": 180
      },
      {
        "carrier_name": "Northwest",
        "flight_count": 168
      },
      {
        "carrier_name": "Continental",
        "flight_count": 35
      },
      {
        "carrier_name": "Jetblue",
        "flight_count": 21
      },
      {
        "carrier_name": "Delta",
        "flight_count": 19
      },
      {
        "carrier_name": "ATA",
        "flight_count": 9
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 77
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 65
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 64
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 56
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 60
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 55
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 78
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 60
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 48
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 39
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 42
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 50
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 56
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 56
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 43
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 48
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 45
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 43
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 47
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 60
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 64
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 45
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 64
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 73
      },
      {
        "dep_month": "2002-04-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 60
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 71
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 47
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 69
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 61
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 50
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2000-09-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 38
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 60
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 35
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 52
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 53
      }
    ]
  },
  {
    "origin_name": "SMF - SACRAMENTO",
    "flight_count": 3576,
    "total_distance": 2367376,
    "percent_of_flights": 0.08792721908040324,
    "destination_name": [
      {
        "destination_name": "PHX - PHOENIX",
        "flight_count": 479,
        "total_distance": 309913,
        "percent_of_flights": 0.13394854586129754,
        "cl": [
          {
            "nickname": "America West",
            "flight_count": 249
          },
          {
            "nickname": "Southwest",
            "flight_count": 230
          }
        ]
      },
      {
        "destination_name": "SAN - SAN DIEGO",
        "flight_count": 396,
        "total_distance": 190080,
        "percent_of_flights": 0.11073825503355705,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 396
          }
        ]
      },
      {
        "destination_name": "LAX - LOS ANGELES",
        "flight_count": 382,
        "total_distance": 142486,
        "percent_of_flights": 0.10682326621923938,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 345
          },
          {
            "nickname": "United",
            "flight_count": 37
          }
        ]
      },
      {
        "destination_name": "ONT - ONTARIO",
        "flight_count": 380,
        "total_distance": 147820,
        "percent_of_flights": 0.10626398210290827,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 380
          }
        ]
      },
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 327,
        "total_distance": 129819,
        "percent_of_flights": 0.09144295302013423,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 269
          },
          {
            "nickname": "America West",
            "flight_count": 58
          }
        ]
      },
      {
        "destination_name": "BUR - BURBANK",
        "flight_count": 279,
        "total_distance": 99882,
        "percent_of_flights": 0.07802013422818792,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 279
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "Southwest",
        "flight_count": 2471
      },
      {
        "carrier_name": "America West",
        "flight_count": 376
      },
      {
        "carrier_name": "United",
        "flight_count": 281
      },
      {
        "carrier_name": "American",
        "flight_count": 138
      },
      {
        "carrier_name": "Alaska",
        "flight_count": 132
      },
      {
        "carrier_name": "Northwest",
        "flight_count": 110
      },
      {
        "carrier_name": "Delta",
        "flight_count": 29
      },
      {
        "carrier_name": "Continental",
        "flight_count": 21
      },
      {
        "carrier_name": "Jetblue",
        "flight_count": 18
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 62
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 64
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 56
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 55
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 63
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 52
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 70
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 67
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 47
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 41
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 60
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 47
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 48
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 50
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 56
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 41
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 60
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 52
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 31
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 45
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 68
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 47
      },
      {
        "dep_month": "2002-04-01T00:00:00.000Z",
        "flight_count": 37
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 59
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 54
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 48
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 43
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 53
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 39
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 45
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 39
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 41
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 29
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 39
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2000-09-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 50
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 55
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 43
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 47
      }
    ]
  },
  {
    "origin_name": "ONT - ONTARIO",
    "flight_count": 2642,
    "total_distance": 1492508,
    "percent_of_flights": 0.06496188836980575,
    "destination_name": [
      {
        "destination_name": "PHX - PHOENIX",
        "flight_count": 491,
        "total_distance": 159575,
        "percent_of_flights": 0.1858440575321726,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 380
          },
          {
            "nickname": "America West",
            "flight_count": 111
          }
        ]
      },
      {
        "destination_name": "SMF - SACRAMENTO",
        "flight_count": 412,
        "total_distance": 160268,
        "percent_of_flights": 0.15594246782740348,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 412
          }
        ]
      },
      {
        "destination_name": "OAK - OAKLAND",
        "flight_count": 411,
        "total_distance": 148371,
        "percent_of_flights": 0.15556396669190006,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 411
          }
        ]
      },
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 344,
        "total_distance": 67768,
        "percent_of_flights": 0.13020439061317185,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 323
          },
          {
            "nickname": "America West",
            "flight_count": 21
          }
        ]
      },
      {
        "destination_name": "SJC - SAN JOSE",
        "flight_count": 236,
        "total_distance": 78588,
        "percent_of_flights": 0.08932626797880394,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 236
          }
        ]
      },
      {
        "destination_name": "SEA - SEATTLE",
        "flight_count": 145,
        "total_distance": 138620,
        "percent_of_flights": 0.05488266464799394,
        "cl": [
          {
            "nickname": "Alaska",
            "flight_count": 145
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "Southwest",
        "flight_count": 1804
      },
      {
        "carrier_name": "Alaska",
        "flight_count": 236
      },
      {
        "carrier_name": "United",
        "flight_count": 153
      },
      {
        "carrier_name": "American",
        "flight_count": 142
      },
      {
        "carrier_name": "America West",
        "flight_count": 132
      },
      {
        "carrier_name": "Northwest",
        "flight_count": 105
      },
      {
        "carrier_name": "Jetblue",
        "flight_count": 31
      },
      {
        "carrier_name": "Delta",
        "flight_count": 27
      },
      {
        "carrier_name": "Continental",
        "flight_count": 11
      },
      {
        "carrier_name": "Continental Express",
        "flight_count": 1
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 48
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 42
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 58
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 42
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 41
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 35
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 38
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 52
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 48
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 57
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 28
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 45
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 20
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 32
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 31
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 38
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 51
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 31
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 38
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 31
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 25
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 42
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 44
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 37
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2002-04-01T00:00:00.000Z",
        "flight_count": 31
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 32
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 35
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 41
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 39
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 32
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 39
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 47
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 42
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 37
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 29
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 37
      },
      {
        "dep_month": "2000-09-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 26
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 28
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 45
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 36
      }
    ]
  },
  {
    "origin_name": "BUR - BURBANK",
    "flight_count": 1952,
    "total_distance": 876479,
    "percent_of_flights": 0.04799606589623801,
    "destination_name": [
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 388,
        "total_distance": 86524,
        "percent_of_flights": 0.1987704918032787,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 384
          },
          {
            "nickname": "America West",
            "flight_count": 4
          }
        ]
      },
      {
        "destination_name": "OAK - OAKLAND",
        "flight_count": 367,
        "total_distance": 119275,
        "percent_of_flights": 0.1880122950819672,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 367
          }
        ]
      },
      {
        "destination_name": "PHX - PHOENIX",
        "flight_count": 357,
        "total_distance": 131733,
        "percent_of_flights": 0.18288934426229508,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 260
          },
          {
            "nickname": "America West",
            "flight_count": 97
          }
        ]
      },
      {
        "destination_name": "SMF - SACRAMENTO",
        "flight_count": 260,
        "total_distance": 93080,
        "percent_of_flights": 0.13319672131147542,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 260
          }
        ]
      },
      {
        "destination_name": "SJC - SAN JOSE",
        "flight_count": 206,
        "total_distance": 60976,
        "percent_of_flights": 0.10553278688524591,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 206
          }
        ]
      },
      {
        "destination_name": "SEA - SEATTLE",
        "flight_count": 154,
        "total_distance": 144298,
        "percent_of_flights": 0.07889344262295082,
        "cl": [
          {
            "nickname": "Alaska",
            "flight_count": 154
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "Southwest",
        "flight_count": 1477
      },
      {
        "carrier_name": "Alaska",
        "flight_count": 248
      },
      {
        "carrier_name": "America West",
        "flight_count": 101
      },
      {
        "carrier_name": "American",
        "flight_count": 96
      },
      {
        "carrier_name": "Jetblue",
        "flight_count": 16
      },
      {
        "carrier_name": "United",
        "flight_count": 13
      },
      {
        "carrier_name": "Delta",
        "flight_count": 1
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 37
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 35
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 42
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 49
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 28
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 31
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 28
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 39
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 25
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 21
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 29
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 28
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 37
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 25
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 31
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 26
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 26
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2002-04-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 29
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 21
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 32
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 26
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 16
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 25
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 25
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 18
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 41
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 25
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2000-09-01T00:00:00.000Z",
        "flight_count": 17
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 24
      }
    ]
  },
  {
    "origin_name": "SNA - SANTA ANA",
    "flight_count": 1919,
    "total_distance": 1377110,
    "percent_of_flights": 0.04718465699532825,
    "destination_name": [
      {
        "destination_name": "PHX - PHOENIX",
        "flight_count": 297,
        "total_distance": 100386,
        "percent_of_flights": 0.15476810838978636,
        "cl": [
          {
            "nickname": "America West",
            "flight_count": 174
          },
          {
            "nickname": "Southwest",
            "flight_count": 123
          }
        ]
      },
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 260,
        "total_distance": 58760,
        "percent_of_flights": 0.1354872329338197,
        "cl": [
          {
            "nickname": "America West",
            "flight_count": 157
          },
          {
            "nickname": "Southwest",
            "flight_count": 100
          },
          {
            "nickname": "American",
            "flight_count": 2
          },
          {
            "nickname": "Delta",
            "flight_count": 1
          }
        ]
      },
      {
        "destination_name": "SMF - SACRAMENTO",
        "flight_count": 252,
        "total_distance": 101808,
        "percent_of_flights": 0.13131839499739448,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 163
          },
          {
            "nickname": "America West",
            "flight_count": 89
          }
        ]
      },
      {
        "destination_name": "SFO - SAN FRANCISCO",
        "flight_count": 177,
        "total_distance": 65844,
        "percent_of_flights": 0.09223553934340803,
        "cl": [
          {
            "nickname": "United",
            "flight_count": 171
          },
          {
            "nickname": "American",
            "flight_count": 6
          }
        ]
      },
      {
        "destination_name": "DEN - DENVER",
        "flight_count": 173,
        "total_distance": 146358,
        "percent_of_flights": 0.09015112037519542,
        "cl": [
          {
            "nickname": "United",
            "flight_count": 173
          }
        ]
      },
      {
        "destination_name": "OAK - OAKLAND",
        "flight_count": 160,
        "total_distance": 59360,
        "percent_of_flights": 0.08337675872850443,
        "cl": [
          {
            "nickname": "Southwest",
            "flight_count": 160
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "Southwest",
        "flight_count": 658
      },
      {
        "carrier_name": "United",
        "flight_count": 460
      },
      {
        "carrier_name": "America West",
        "flight_count": 420
      },
      {
        "carrier_name": "Northwest",
        "flight_count": 133
      },
      {
        "carrier_name": "USAir",
        "flight_count": 105
      },
      {
        "carrier_name": "American",
        "flight_count": 92
      },
      {
        "carrier_name": "Delta",
        "flight_count": 51
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 40
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 37
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 37
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 39
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 32
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 35
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 26
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 43
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 29
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 18
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 46
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 25
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 32
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 29
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 29
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 21
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 21
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 28
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 30
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 26
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 36
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 20
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 21
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 29
      },
      {
        "dep_month": "2002-04-01T00:00:00.000Z",
        "flight_count": 34
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 38
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 28
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 21
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 20
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 20
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 18
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 28
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 21
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 17
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 16
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 17
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 15
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2000-09-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 18
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 14
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 20
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 29
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 27
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 18
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 28
      }
    ]
  },
  {
    "origin_name": "LGB - LONG BEACH",
    "flight_count": 661,
    "total_distance": 931914,
    "percent_of_flights": 0.016252766166707646,
    "destination_name": [
      {
        "destination_name": "JFK - NEW YORK",
        "flight_count": 149,
        "total_distance": 367285,
        "percent_of_flights": 0.2254160363086233,
        "cl": [
          {
            "nickname": "Jetblue",
            "flight_count": 149
          }
        ]
      },
      {
        "destination_name": "OAK - OAKLAND",
        "flight_count": 117,
        "total_distance": 41301,
        "percent_of_flights": 0.17700453857791226,
        "cl": [
          {
            "nickname": "Jetblue",
            "flight_count": 117
          }
        ]
      },
      {
        "destination_name": "DFW - DALLAS-FORT WORTH",
        "flight_count": 97,
        "total_distance": 118340,
        "percent_of_flights": 0.14674735249621784,
        "cl": [
          {
            "nickname": "American",
            "flight_count": 97
          }
        ]
      },
      {
        "destination_name": "IAD - WASHINGTON",
        "flight_count": 77,
        "total_distance": 175329,
        "percent_of_flights": 0.11649016641452345,
        "cl": [
          {
            "nickname": "Jetblue",
            "flight_count": 77
          }
        ]
      },
      {
        "destination_name": "LAS - LAS VEGAS",
        "flight_count": 56,
        "total_distance": 12936,
        "percent_of_flights": 0.08472012102874432,
        "cl": [
          {
            "nickname": "Jetblue",
            "flight_count": 56
          }
        ]
      },
      {
        "destination_name": "PHX - PHOENIX",
        "flight_count": 54,
        "total_distance": 19170,
        "percent_of_flights": 0.08169440242057488,
        "cl": [
          {
            "nickname": "America West",
            "flight_count": 54
          }
        ]
      }
    ],
    "carrier_name": [
      {
        "carrier_name": "Jetblue",
        "flight_count": 471
      },
      {
        "carrier_name": "American",
        "flight_count": 126
      },
      {
        "carrier_name": "America West",
        "flight_count": 54
      },
      {
        "carrier_name": "Alaska",
        "flight_count": 10
      }
    ],
    "dep_month": [
      {
        "dep_month": "2005-12-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2005-11-01T00:00:00.000Z",
        "flight_count": 22
      },
      {
        "dep_month": "2005-10-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2005-09-01T00:00:00.000Z",
        "flight_count": 14
      },
      {
        "dep_month": "2005-08-01T00:00:00.000Z",
        "flight_count": 13
      },
      {
        "dep_month": "2005-07-01T00:00:00.000Z",
        "flight_count": 24
      },
      {
        "dep_month": "2005-06-01T00:00:00.000Z",
        "flight_count": 23
      },
      {
        "dep_month": "2005-05-01T00:00:00.000Z",
        "flight_count": 12
      },
      {
        "dep_month": "2005-04-01T00:00:00.000Z",
        "flight_count": 3
      },
      {
        "dep_month": "2005-03-01T00:00:00.000Z",
        "flight_count": 5
      },
      {
        "dep_month": "2005-02-01T00:00:00.000Z",
        "flight_count": 8
      },
      {
        "dep_month": "2005-01-01T00:00:00.000Z",
        "flight_count": 17
      },
      {
        "dep_month": "2004-12-01T00:00:00.000Z",
        "flight_count": 13
      },
      {
        "dep_month": "2004-11-01T00:00:00.000Z",
        "flight_count": 10
      },
      {
        "dep_month": "2004-10-01T00:00:00.000Z",
        "flight_count": 9
      },
      {
        "dep_month": "2004-09-01T00:00:00.000Z",
        "flight_count": 18
      },
      {
        "dep_month": "2004-08-01T00:00:00.000Z",
        "flight_count": 17
      },
      {
        "dep_month": "2004-07-01T00:00:00.000Z",
        "flight_count": 15
      },
      {
        "dep_month": "2004-06-01T00:00:00.000Z",
        "flight_count": 15
      },
      {
        "dep_month": "2004-05-01T00:00:00.000Z",
        "flight_count": 6
      },
      {
        "dep_month": "2004-04-01T00:00:00.000Z",
        "flight_count": 11
      },
      {
        "dep_month": "2004-03-01T00:00:00.000Z",
        "flight_count": 10
      },
      {
        "dep_month": "2004-02-01T00:00:00.000Z",
        "flight_count": 12
      },
      {
        "dep_month": "2004-01-01T00:00:00.000Z",
        "flight_count": 10
      },
      {
        "dep_month": "2003-12-01T00:00:00.000Z",
        "flight_count": 15
      },
      {
        "dep_month": "2003-11-01T00:00:00.000Z",
        "flight_count": 17
      },
      {
        "dep_month": "2003-10-01T00:00:00.000Z",
        "flight_count": 19
      },
      {
        "dep_month": "2003-09-01T00:00:00.000Z",
        "flight_count": 21
      },
      {
        "dep_month": "2003-08-01T00:00:00.000Z",
        "flight_count": 11
      },
      {
        "dep_month": "2003-07-01T00:00:00.000Z",
        "flight_count": 15
      },
      {
        "dep_month": "2003-06-01T00:00:00.000Z",
        "flight_count": 25
      },
      {
        "dep_month": "2003-05-01T00:00:00.000Z",
        "flight_count": 17
      },
      {
        "dep_month": "2003-04-01T00:00:00.000Z",
        "flight_count": 17
      },
      {
        "dep_month": "2003-03-01T00:00:00.000Z",
        "flight_count": 12
      },
      {
        "dep_month": "2003-02-01T00:00:00.000Z",
        "flight_count": 3
      },
      {
        "dep_month": "2003-01-01T00:00:00.000Z",
        "flight_count": 33
      },
      {
        "dep_month": "2002-12-01T00:00:00.000Z",
        "flight_count": 5
      },
      {
        "dep_month": "2002-11-01T00:00:00.000Z",
        "flight_count": 3
      },
      {
        "dep_month": "2002-10-01T00:00:00.000Z",
        "flight_count": 7
      },
      {
        "dep_month": "2002-09-01T00:00:00.000Z",
        "flight_count": 5
      },
      {
        "dep_month": "2002-08-01T00:00:00.000Z",
        "flight_count": 2
      },
      {
        "dep_month": "2002-07-01T00:00:00.000Z",
        "flight_count": 4
      },
      {
        "dep_month": "2002-06-01T00:00:00.000Z",
        "flight_count": 1
      },
      {
        "dep_month": "2002-05-01T00:00:00.000Z",
        "flight_count": 2
      },
      {
        "dep_month": "2002-03-01T00:00:00.000Z",
        "flight_count": 3
      },
      {
        "dep_month": "2002-02-01T00:00:00.000Z",
        "flight_count": 3
      },
      {
        "dep_month": "2002-01-01T00:00:00.000Z",
        "flight_count": 1
      },
      {
        "dep_month": "2001-12-01T00:00:00.000Z",
        "flight_count": 3
      },
      {
        "dep_month": "2001-11-01T00:00:00.000Z",
        "flight_count": 2
      },
      {
        "dep_month": "2001-10-01T00:00:00.000Z",
        "flight_count": 2
      },
      {
        "dep_month": "2001-09-01T00:00:00.000Z",
        "flight_count": 4
      },
      {
        "dep_month": "2001-08-01T00:00:00.000Z",
        "flight_count": 4
      },
      {
        "dep_month": "2001-07-01T00:00:00.000Z",
        "flight_count": 2
      },
      {
        "dep_month": "2001-06-01T00:00:00.000Z",
        "flight_count": 3
      },
      {
        "dep_month": "2001-05-01T00:00:00.000Z",
        "flight_count": 5
      },
      {
        "dep_month": "2001-04-01T00:00:00.000Z",
        "flight_count": 2
      },
      {
        "dep_month": "2001-03-01T00:00:00.000Z",
        "flight_count": 3
      },
      {
        "dep_month": "2001-02-01T00:00:00.000Z",
        "flight_count": 4
      },
      {
        "dep_month": "2001-01-01T00:00:00.000Z",
        "flight_count": 9
      },
      {
        "dep_month": "2000-12-01T00:00:00.000Z",
        "flight_count": 4
      },
      {
        "dep_month": "2000-11-01T00:00:00.000Z",
        "flight_count": 1
      },
      {
        "dep_month": "2000-10-01T00:00:00.000Z",
        "flight_count": 1
      },
      {
        "dep_month": "2000-08-01T00:00:00.000Z",
        "flight_count": 5
      },
      {
        "dep_month": "2000-07-01T00:00:00.000Z",
        "flight_count": 7
      },
      {
        "dep_month": "2000-06-01T00:00:00.000Z",
        "flight_count": 4
      },
      {
        "dep_month": "2000-05-01T00:00:00.000Z",
        "flight_count": 7
      },
      {
        "dep_month": "2000-04-01T00:00:00.000Z",
        "flight_count": 4
      },
      {
        "dep_month": "2000-03-01T00:00:00.000Z",
        "flight_count": 7
      },
      {
        "dep_month": "2000-02-01T00:00:00.000Z",
        "flight_count": 6
      },
      {
        "dep_month": "2000-01-01T00:00:00.000Z",
        "flight_count": 2
      }
    ]
  }
]
WITH __stage0 AS (
  SELECT
    group_set,
    CASE WHEN group_set IN (1,2,3,4,5) THEN
      CONCAT(origin_0."code",' - ',origin_0."city")
      END as "origin_name__1",
    CASE WHEN group_set=1 THEN
      COUNT( 1)
      END as "flight_count__1",
    CASE WHEN group_set=1 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__1",
    (CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=0 THEN
      COUNT( 1)
      END)) OVER () as "percent_of_flights__1",
    CASE WHEN group_set IN (2,3) THEN
      CONCAT(destination_0."code",' - ',destination_0."city")
      END as "destination_name__2",
    CASE WHEN group_set=2 THEN
      COUNT( 1)
      END as "flight_count__2",
    CASE WHEN group_set=2 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__2",
    (CASE WHEN group_set=2 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)) OVER (PARTITION BY CASE WHEN group_set IN (1,2,3,4,5) THEN
      CONCAT(origin_0."code",' - ',origin_0."city")
      END) as "percent_of_flights__2",
    CASE WHEN group_set=3 THEN
      carriers_0."nickname"
      END as "nickname__3",
    CASE WHEN group_set=3 THEN
      COUNT( 1)
      END as "flight_count__3",
    CASE WHEN group_set=4 THEN
      carriers_0."nickname"
      END as "carrier_name__4",
    CASE WHEN group_set=4 THEN
      COUNT( 1)
      END as "flight_count__4",
    CASE WHEN group_set=5 THEN
      DATE_TRUNC('month', flights."dep_time")
      END as "dep_month__5",
    CASE WHEN group_set=5 THEN
      COUNT( 1)
      END as "flight_count__5"
  FROM '../../documentation/data/flights.parquet' as flights
   LEFT JOIN '../../documentation/data/airports.parquet' AS origin_0
    ON origin_0."code"=flights."origin"
   LEFT JOIN '../../documentation/data/airports.parquet' AS destination_0
    ON destination_0."code"=flights."destination"
   LEFT JOIN '../../documentation/data/carriers.parquet' AS carriers_0
    ON carriers_0."code"=flights."carrier"
  CROSS JOIN (SELECT UNNEST(GENERATE_SERIES(0,5,1)) as group_set  ) as group_set
  WHERE origin_0."state"='CA'
  GROUP BY 1,2,6,10,12,14
)
, __stage1 AS (
  SELECT 
    CASE WHEN group_set=3 THEN 2  ELSE group_set END as group_set,
    CASE WHEN group_set IN (1,2,3,4,5) THEN
      "origin_name__1"
      END as "origin_name__1",
    FIRST("flight_count__1") FILTER (WHERE "flight_count__1" IS NOT NULL) as "flight_count__1",
    FIRST("total_distance__1") FILTER (WHERE "total_distance__1" IS NOT NULL) as "total_distance__1",
    FIRST("percent_of_flights__1") FILTER (WHERE "percent_of_flights__1" IS NOT NULL) as "percent_of_flights__1",
    CASE WHEN group_set IN (2,3) THEN
      "destination_name__2"
      END as "destination_name__2",
    FIRST("flight_count__2") FILTER (WHERE "flight_count__2" IS NOT NULL) as "flight_count__2",
    FIRST("total_distance__2") FILTER (WHERE "total_distance__2" IS NOT NULL) as "total_distance__2",
    FIRST("percent_of_flights__2") FILTER (WHERE "percent_of_flights__2" IS NOT NULL) as "percent_of_flights__2",
    COALESCE(LIST({
      "nickname": "nickname__3", 
      "flight_count": "flight_count__3"}  ORDER BY  "flight_count__3" desc NULLS LAST) FILTER (WHERE group_set=3),[]) as "cl__2",
    CASE WHEN group_set=4 THEN
      "carrier_name__4"
      END as "carrier_name__4",
    FIRST("flight_count__4") FILTER (WHERE "flight_count__4" IS NOT NULL) as "flight_count__4",
    CASE WHEN group_set=5 THEN
      "dep_month__5"
      END as "dep_month__5",
    FIRST("flight_count__5") FILTER (WHERE "flight_count__5" IS NOT NULL) as "flight_count__5"
  FROM __stage0
  WHERE group_set NOT IN (0)
  GROUP BY 1,2,6,11,13
)
SELECT
  "origin_name__1" as "origin_name",
  MAX(CASE WHEN group_set=1 THEN "flight_count__1" END) as "flight_count",
  MAX(CASE WHEN group_set=1 THEN "total_distance__1" END) as "total_distance",
  MAX(CASE WHEN group_set=1 THEN "percent_of_flights__1" END) as "percent_of_flights",
  COALESCE(LIST({
    "destination_name": "destination_name__2", 
    "flight_count": "flight_count__2", 
    "total_distance": "total_distance__2", 
    "percent_of_flights": "percent_of_flights__2", 
    "cl": "cl__2"}  ORDER BY  "flight_count__2" desc NULLS LAST) FILTER (WHERE group_set=2)[1:6],[]) as "destination_name",
  COALESCE(LIST({
    "carrier_name": "carrier_name__4", 
    "flight_count": "flight_count__4"}  ORDER BY  "flight_count__4" desc NULLS LAST) FILTER (WHERE group_set=4),[]) as "carrier_name",
  COALESCE(LIST({
    "dep_month": "dep_month__5", 
    "flight_count": "flight_count__5"}  ORDER BY  "dep_month__5" desc NULLS LAST) FILTER (WHERE group_set=5),[]) as "dep_month"
FROM __stage1
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Wait, that looks really complex? What do those things mean?

If you press the control key and hover over any of the terms, the Malloy VSCode extension will show you the semantic definition for the term.

Back to Step 1: How big is the pile?

Ok, let's slow down and go step by step.

Often, the first thing you want to know is, how big is the dataset?

document
run: flights-> flight_count
QUERY RESULTS
flight_​count
344,827
[
  {
    "flight_count": 344827
  }
]
SELECT 
   COUNT( 1) as "flight_count"
FROM '../../documentation/data/flights.parquet' as flights

In Malloy, queries start with run: <source>. In this case, flights. The -> is the query transform operator. The right hand side of the -> is the query transformation. In this case we want a simple measure, flight_count.

Dimensions and Measures

As we talked about earlier. Aggregating queries have two parts: what you want to group by, and what you want to measure about things in that group. Let's group the flights by the origin, and count how many flights. When building a query, we use the + operator to combine the parts.

document
run: flights -> origin_name + flight_count 
QUERY RESULTS
origin_​nameflight_​count
ATL - ATLANTA17,875
DFW - DALLAS-FORT WORTH17,782
ORD - CHICAGO14,214
PHX - PHOENIX12,476
LAS - LAS VEGAS11,096
LAX - LOS ANGELES11,077
MSP - MINNEAPOLIS9,762
DTW - DETROIT8,161
PHL - PHILADELPHIA7,708
LGA - NEW YORK7,623
DEN - DENVER7,190
BWI - BALTIMORE7,177
CLT - CHARLOTTE7,099
SEA - SEATTLE7,010
MCO - ORLANDO6,790
DCA - WASHINGTON6,678
IAH - HOUSTON6,623
MDW - CHICAGO6,611
BOS - BOSTON5,797
EWR - NEWARK5,174
CLE - CLEVELAND5,127
OAK - OAKLAND5,076
SAN - SAN DIEGO5,075
TPA - TAMPA4,868
PIT - PITTSBURGH4,541
SFO - SAN FRANCISCO4,540
BNA - NASHVILLE4,287
STL - ST LOUIS4,089
MCI - KANSAS CITY4,078
IAD - WASHINGTON3,885
SJC - SAN JOSE3,825
JFK - NEW YORK3,689
FLL - FORT LAUDERDALE3,619
PDX - PORTLAND3,596
SMF - SACRAMENTO3,576
HOU - HOUSTON3,430
CVG - COVINGTON/CINCINNATI, OH3,300
MSY - NEW ORLEANS3,254
ABQ - ALBUQUERQUE2,762
SLC - SALT LAKE CITY2,741
ONT - ONTARIO2,642
RDU - RALEIGH/DURHAM2,444
MIA - MIAMI2,387
PVD - PROVIDENCE2,361
MEM - MEMPHIS2,242
IND - INDIANAPOLIS2,226
BDL - WINDSOR LOCKS2,168
AUS - AUSTIN2,091
RNO - RENO1,992
BUR - BURBANK1,952
SNA - SANTA ANA1,919
SAT - SAN ANTONIO1,865
CMH - COLUMBUS1,712
DAL - DALLAS1,662
MHT - MANCHESTER1,626
JAX - JACKSONVILLE1,599
ELP - EL PASO1,438
PBI - WEST PALM BEACH1,379
ISP - ISLIP1,302
BUF - BUFFALO1,246
BHM - BIRMINGHAM1,200
RSW - FORT MYERS1,169
MKE - MILWAUKEE1,132
ALB - ALBANY1,108
TUS - TUCSON1,062
SDF - LOUISVILLE1,003
TUL - TULSA984
OMA - OMAHA946
RIC - RICHMOND946
GEG - SPOKANE922
OKC - OKLAHOMA CITY905
ORF - NORFOLK888
LIT - LITTLE ROCK853
BOI - BOISE795
PFN - PANAMA CITY778
AGS - AUGUSTA756
ANC - ANCHORAGE748
ROC - ROCHESTER733
AVL - ASHEVILLE727
CHA - CHATTANOOGA697
LGB - LONG BEACH661
CSG - COLUMBUS654
SJU - SAN JUAN645
MYR - MYRTLE BEACH628
HSV - HUNTSVILLE607
SYR - SYRACUSE597
MDT - HARRISBURG584
TRI - BRISTOL/JOHNSON/KINGSPORT566
GRR - GRAND RAPIDS513
ABE - ALLENTOWN510
MGM - MONTGOMERY500
ACT - WACO494
TYR - TYLER480
GNV - GAINESVILLE470
GSO - GREENSBORO470
CHS - CHARLESTON466
TYS - KNOXVILLE464
SPS - WICHITA FALLS457
CLL - COLLEGE STATION454
COS - COLORADO SPRINGS426
LBB - LUBBOCK425
LAW - LAWTON423
SAV - SAVANNAH419
DAY - DAYTON416
ILE - KILLEEN416
MAF - MIDLAND409
SHV - SHREVEPORT406
VPS - VALPARAISO403
CAE - COLUMBIA376
JAN - JACKSON356
PWM - PORTLAND326
DHN - DOTHAN324
XNA - FAYETTEVILLE/SPRINGDALE/319
HPN - WHITE PLAINS315
BTV - BURLINGTON307
LEX - LEXINGTON305
AMA - AMARILLO298
ABI - ABILENE297
TLH - TALLAHASSEE285
GPT - GULFPORT278
BTR - BATON ROUGE274
MSN - MADISON271
HNL - HONOLULU267
GGG - LONGVIEW258
DSM - DES MOINES254
GSP - GREER241
PSP - PALM SPRINGS240
SJT - SAN ANGELO223
TXK - TEXARKANA207
FSM - FORT SMITH202
VLD - VALDOSTA200
PNS - PENSACOLA194
SRQ - SARASOTA/BRADENTON192
HRL - HARLINGEN185
SGF - SPRINGFIELD185
ICT - WICHITA183
CRP - CORPUS CHRISTI181
LFT - LAFAYETTE176
GRK - FORT HOOD/KILLEEN161
ROA - ROANOKE158
MFE - MC ALLEN154
ILM - WILMINGTON128
MOB - MOBILE125
FAI - FAIRBANKS114
OGG - KAHULUI110
LRD - LAREDO107
MCN - MACON102
BRO - BROWNSVILLE94
BGR - BANGOR94
JAC - JACKSON86
FAY - FAYETTEVILLE83
FNT - FLINT83
FAR - FARGO83
AEX - ALEXANDRIA80
BPT - BEAUMONT/PORT ARTHUR77
STT - CHARLOTTE AMALIE76
PIE - ST PETERSBURG-CLEARWATER65
BZN - BOZEMAN62
FAT - FRESNO57
AVP - WILKES-BARRE/SCRANTON51
GRB - GREEN BAY47
EVV - EVANSVILLE42
MSO - MISSOULA41
LCH - LAKE CHARLES41
TOL - TOLEDO40
LAN - LANSING40
CID - CEDAR RAPIDS40
DLH - DULUTH40
GTR - COLUMBUS/W POINT/STARKVILL37
MEI - MERIDIAN37
FSD - SIOUX FALLS35
MTJ - MONTROSE32
CAK - AKRON32
CRW - CHARLESTON32
FWA - FORT WAYNE31
DAB - DAYTONA BEACH31
SBN - SOUTH BEND25
ATW - APPLETON24
KOA - KAILUA/KONA24
EGE - EAGLE24
RAP - RAPID CITY22
ERI - ERIE21
EFD - HOUSTON21
AZO - KALAMAZOO19
ACY - ATLANTIC CITY18
SBA - SANTA BARBARA18
GTF - GREAT FALLS18
MLI - MOLINE17
FCA - KALISPELL17
ACK - NANTUCKET15
BIL - BILLINGS15
MLU - MONROE15
- 14
LYH - LYNCHBURG14
BGM - BINGHAMTON13
SWF - NEWBURGH13
ORH - WORCESTER12
HDN - HAYDEN12
MLB - MELBOURNE10
CHO - CHARLOTTESVILLE9
BQN - AGUADILLA9
LNK - LINCOLN9
BFL - BAKERSFIELD9
CMI - CHAMPAIGN/URBANA8
GUC - GUNNISON7
ABY - ALBANY6
EUG - EUGENE5
DRO - DURANGO5
HLN - HELENA5
BIS - BISMARCK5
HTS - HUNTINGTON4
HVN - NEW HAVEN4
MRY - MONTEREY3
STX - CHRISTIANSTED3
EYW - KEY WEST3
PSE - PONCE3
VCT - VICTORIA3
BQK - BRUNSWICK2
TVC - TRAVERSE CITY2
MFR - MEDFORD1
FLO - FLORENCE1
LSE - LA CROSSE1
ELM - ELMIRA/CORNING1
PHF - NEWPORT NEWS1
ITH - ITHACA1
[
  {
    "origin_name": "ATL - ATLANTA",
    "flight_count": 17875
  },
  {
    "origin_name": "DFW - DALLAS-FORT WORTH",
    "flight_count": 17782
  },
  {
    "origin_name": "ORD - CHICAGO",
    "flight_count": 14214
  },
  {
    "origin_name": "PHX - PHOENIX",
    "flight_count": 12476
  },
  {
    "origin_name": "LAS - LAS VEGAS",
    "flight_count": 11096
  },
  {
    "origin_name": "LAX - LOS ANGELES",
    "flight_count": 11077
  },
  {
    "origin_name": "MSP - MINNEAPOLIS",
    "flight_count": 9762
  },
  {
    "origin_name": "DTW - DETROIT",
    "flight_count": 8161
  },
  {
    "origin_name": "PHL - PHILADELPHIA",
    "flight_count": 7708
  },
  {
    "origin_name": "LGA - NEW YORK",
    "flight_count": 7623
  },
  {
    "origin_name": "DEN - DENVER",
    "flight_count": 7190
  },
  {
    "origin_name": "BWI - BALTIMORE",
    "flight_count": 7177
  },
  {
    "origin_name": "CLT - CHARLOTTE",
    "flight_count": 7099
  },
  {
    "origin_name": "SEA - SEATTLE",
    "flight_count": 7010
  },
  {
    "origin_name": "MCO - ORLANDO",
    "flight_count": 6790
  },
  {
    "origin_name": "DCA - WASHINGTON",
    "flight_count": 6678
  },
  {
    "origin_name": "IAH - HOUSTON",
    "flight_count": 6623
  },
  {
    "origin_name": "MDW - CHICAGO",
    "flight_count": 6611
  },
  {
    "origin_name": "BOS - BOSTON",
    "flight_count": 5797
  },
  {
    "origin_name": "EWR - NEWARK",
    "flight_count": 5174
  },
  {
    "origin_name": "CLE - CLEVELAND",
    "flight_count": 5127
  },
  {
    "origin_name": "OAK - OAKLAND",
    "flight_count": 5076
  },
  {
    "origin_name": "SAN - SAN DIEGO",
    "flight_count": 5075
  },
  {
    "origin_name": "TPA - TAMPA",
    "flight_count": 4868
  },
  {
    "origin_name": "PIT - PITTSBURGH",
    "flight_count": 4541
  },
  {
    "origin_name": "SFO - SAN FRANCISCO",
    "flight_count": 4540
  },
  {
    "origin_name": "BNA - NASHVILLE",
    "flight_count": 4287
  },
  {
    "origin_name": "STL - ST LOUIS",
    "flight_count": 4089
  },
  {
    "origin_name": "MCI - KANSAS CITY",
    "flight_count": 4078
  },
  {
    "origin_name": "IAD - WASHINGTON",
    "flight_count": 3885
  },
  {
    "origin_name": "SJC - SAN JOSE",
    "flight_count": 3825
  },
  {
    "origin_name": "JFK - NEW YORK",
    "flight_count": 3689
  },
  {
    "origin_name": "FLL - FORT LAUDERDALE",
    "flight_count": 3619
  },
  {
    "origin_name": "PDX - PORTLAND",
    "flight_count": 3596
  },
  {
    "origin_name": "SMF - SACRAMENTO",
    "flight_count": 3576
  },
  {
    "origin_name": "HOU - HOUSTON",
    "flight_count": 3430
  },
  {
    "origin_name": "CVG - COVINGTON/CINCINNATI, OH",
    "flight_count": 3300
  },
  {
    "origin_name": "MSY - NEW ORLEANS",
    "flight_count": 3254
  },
  {
    "origin_name": "ABQ - ALBUQUERQUE",
    "flight_count": 2762
  },
  {
    "origin_name": "SLC - SALT LAKE CITY",
    "flight_count": 2741
  },
  {
    "origin_name": "ONT - ONTARIO",
    "flight_count": 2642
  },
  {
    "origin_name": "RDU - RALEIGH/DURHAM",
    "flight_count": 2444
  },
  {
    "origin_name": "MIA - MIAMI",
    "flight_count": 2387
  },
  {
    "origin_name": "PVD - PROVIDENCE",
    "flight_count": 2361
  },
  {
    "origin_name": "MEM - MEMPHIS",
    "flight_count": 2242
  },
  {
    "origin_name": "IND - INDIANAPOLIS",
    "flight_count": 2226
  },
  {
    "origin_name": "BDL - WINDSOR LOCKS",
    "flight_count": 2168
  },
  {
    "origin_name": "AUS - AUSTIN",
    "flight_count": 2091
  },
  {
    "origin_name": "RNO - RENO",
    "flight_count": 1992
  },
  {
    "origin_name": "BUR - BURBANK",
    "flight_count": 1952
  },
  {
    "origin_name": "SNA - SANTA ANA",
    "flight_count": 1919
  },
  {
    "origin_name": "SAT - SAN ANTONIO",
    "flight_count": 1865
  },
  {
    "origin_name": "CMH - COLUMBUS",
    "flight_count": 1712
  },
  {
    "origin_name": "DAL - DALLAS",
    "flight_count": 1662
  },
  {
    "origin_name": "MHT - MANCHESTER",
    "flight_count": 1626
  },
  {
    "origin_name": "JAX - JACKSONVILLE",
    "flight_count": 1599
  },
  {
    "origin_name": "ELP - EL PASO",
    "flight_count": 1438
  },
  {
    "origin_name": "PBI - WEST PALM BEACH",
    "flight_count": 1379
  },
  {
    "origin_name": "ISP - ISLIP",
    "flight_count": 1302
  },
  {
    "origin_name": "BUF - BUFFALO",
    "flight_count": 1246
  },
  {
    "origin_name": "BHM - BIRMINGHAM",
    "flight_count": 1200
  },
  {
    "origin_name": "RSW - FORT MYERS",
    "flight_count": 1169
  },
  {
    "origin_name": "MKE - MILWAUKEE",
    "flight_count": 1132
  },
  {
    "origin_name": "ALB - ALBANY",
    "flight_count": 1108
  },
  {
    "origin_name": "TUS - TUCSON",
    "flight_count": 1062
  },
  {
    "origin_name": "SDF - LOUISVILLE",
    "flight_count": 1003
  },
  {
    "origin_name": "TUL - TULSA",
    "flight_count": 984
  },
  {
    "origin_name": "OMA - OMAHA",
    "flight_count": 946
  },
  {
    "origin_name": "RIC - RICHMOND",
    "flight_count": 946
  },
  {
    "origin_name": "GEG - SPOKANE",
    "flight_count": 922
  },
  {
    "origin_name": "OKC - OKLAHOMA CITY",
    "flight_count": 905
  },
  {
    "origin_name": "ORF - NORFOLK",
    "flight_count": 888
  },
  {
    "origin_name": "LIT - LITTLE ROCK",
    "flight_count": 853
  },
  {
    "origin_name": "BOI - BOISE",
    "flight_count": 795
  },
  {
    "origin_name": "PFN - PANAMA CITY",
    "flight_count": 778
  },
  {
    "origin_name": "AGS - AUGUSTA",
    "flight_count": 756
  },
  {
    "origin_name": "ANC - ANCHORAGE",
    "flight_count": 748
  },
  {
    "origin_name": "ROC - ROCHESTER",
    "flight_count": 733
  },
  {
    "origin_name": "AVL - ASHEVILLE",
    "flight_count": 727
  },
  {
    "origin_name": "CHA - CHATTANOOGA",
    "flight_count": 697
  },
  {
    "origin_name": "LGB - LONG BEACH",
    "flight_count": 661
  },
  {
    "origin_name": "CSG - COLUMBUS",
    "flight_count": 654
  },
  {
    "origin_name": "SJU - SAN JUAN",
    "flight_count": 645
  },
  {
    "origin_name": "MYR - MYRTLE BEACH",
    "flight_count": 628
  },
  {
    "origin_name": "HSV - HUNTSVILLE",
    "flight_count": 607
  },
  {
    "origin_name": "SYR - SYRACUSE",
    "flight_count": 597
  },
  {
    "origin_name": "MDT - HARRISBURG",
    "flight_count": 584
  },
  {
    "origin_name": "TRI - BRISTOL/JOHNSON/KINGSPORT",
    "flight_count": 566
  },
  {
    "origin_name": "GRR - GRAND RAPIDS",
    "flight_count": 513
  },
  {
    "origin_name": "ABE - ALLENTOWN",
    "flight_count": 510
  },
  {
    "origin_name": "MGM - MONTGOMERY",
    "flight_count": 500
  },
  {
    "origin_name": "ACT - WACO",
    "flight_count": 494
  },
  {
    "origin_name": "TYR - TYLER",
    "flight_count": 480
  },
  {
    "origin_name": "GNV - GAINESVILLE",
    "flight_count": 470
  },
  {
    "origin_name": "GSO - GREENSBORO",
    "flight_count": 470
  },
  {
    "origin_name": "CHS - CHARLESTON",
    "flight_count": 466
  },
  {
    "origin_name": "TYS - KNOXVILLE",
    "flight_count": 464
  },
  {
    "origin_name": "SPS - WICHITA FALLS",
    "flight_count": 457
  },
  {
    "origin_name": "CLL - COLLEGE STATION",
    "flight_count": 454
  },
  {
    "origin_name": "COS - COLORADO SPRINGS",
    "flight_count": 426
  },
  {
    "origin_name": "LBB - LUBBOCK",
    "flight_count": 425
  },
  {
    "origin_name": "LAW - LAWTON",
    "flight_count": 423
  },
  {
    "origin_name": "SAV - SAVANNAH",
    "flight_count": 419
  },
  {
    "origin_name": "DAY - DAYTON",
    "flight_count": 416
  },
  {
    "origin_name": "ILE - KILLEEN",
    "flight_count": 416
  },
  {
    "origin_name": "MAF - MIDLAND",
    "flight_count": 409
  },
  {
    "origin_name": "SHV - SHREVEPORT",
    "flight_count": 406
  },
  {
    "origin_name": "VPS - VALPARAISO",
    "flight_count": 403
  },
  {
    "origin_name": "CAE - COLUMBIA",
    "flight_count": 376
  },
  {
    "origin_name": "JAN - JACKSON",
    "flight_count": 356
  },
  {
    "origin_name": "PWM - PORTLAND",
    "flight_count": 326
  },
  {
    "origin_name": "DHN - DOTHAN",
    "flight_count": 324
  },
  {
    "origin_name": "XNA - FAYETTEVILLE/SPRINGDALE/",
    "flight_count": 319
  },
  {
    "origin_name": "HPN - WHITE PLAINS",
    "flight_count": 315
  },
  {
    "origin_name": "BTV - BURLINGTON",
    "flight_count": 307
  },
  {
    "origin_name": "LEX - LEXINGTON",
    "flight_count": 305
  },
  {
    "origin_name": "AMA - AMARILLO",
    "flight_count": 298
  },
  {
    "origin_name": "ABI - ABILENE",
    "flight_count": 297
  },
  {
    "origin_name": "TLH - TALLAHASSEE",
    "flight_count": 285
  },
  {
    "origin_name": "GPT - GULFPORT",
    "flight_count": 278
  },
  {
    "origin_name": "BTR - BATON ROUGE",
    "flight_count": 274
  },
  {
    "origin_name": "MSN - MADISON",
    "flight_count": 271
  },
  {
    "origin_name": "HNL - HONOLULU",
    "flight_count": 267
  },
  {
    "origin_name": "GGG - LONGVIEW",
    "flight_count": 258
  },
  {
    "origin_name": "DSM - DES MOINES",
    "flight_count": 254
  },
  {
    "origin_name": "GSP - GREER",
    "flight_count": 241
  },
  {
    "origin_name": "PSP - PALM SPRINGS",
    "flight_count": 240
  },
  {
    "origin_name": "SJT - SAN ANGELO",
    "flight_count": 223
  },
  {
    "origin_name": "TXK - TEXARKANA",
    "flight_count": 207
  },
  {
    "origin_name": "FSM - FORT SMITH",
    "flight_count": 202
  },
  {
    "origin_name": "VLD - VALDOSTA",
    "flight_count": 200
  },
  {
    "origin_name": "PNS - PENSACOLA",
    "flight_count": 194
  },
  {
    "origin_name": "SRQ - SARASOTA/BRADENTON",
    "flight_count": 192
  },
  {
    "origin_name": "HRL - HARLINGEN",
    "flight_count": 185
  },
  {
    "origin_name": "SGF - SPRINGFIELD",
    "flight_count": 185
  },
  {
    "origin_name": "ICT - WICHITA",
    "flight_count": 183
  },
  {
    "origin_name": "CRP - CORPUS CHRISTI",
    "flight_count": 181
  },
  {
    "origin_name": "LFT - LAFAYETTE",
    "flight_count": 176
  },
  {
    "origin_name": "GRK - FORT HOOD/KILLEEN",
    "flight_count": 161
  },
  {
    "origin_name": "ROA - ROANOKE",
    "flight_count": 158
  },
  {
    "origin_name": "MFE - MC ALLEN",
    "flight_count": 154
  },
  {
    "origin_name": "ILM - WILMINGTON",
    "flight_count": 128
  },
  {
    "origin_name": "MOB - MOBILE",
    "flight_count": 125
  },
  {
    "origin_name": "FAI - FAIRBANKS",
    "flight_count": 114
  },
  {
    "origin_name": "OGG - KAHULUI",
    "flight_count": 110
  },
  {
    "origin_name": "LRD - LAREDO",
    "flight_count": 107
  },
  {
    "origin_name": "MCN - MACON",
    "flight_count": 102
  },
  {
    "origin_name": "BRO - BROWNSVILLE",
    "flight_count": 94
  },
  {
    "origin_name": "BGR - BANGOR",
    "flight_count": 94
  },
  {
    "origin_name": "JAC - JACKSON",
    "flight_count": 86
  },
  {
    "origin_name": "FAY - FAYETTEVILLE",
    "flight_count": 83
  },
  {
    "origin_name": "FNT - FLINT",
    "flight_count": 83
  },
  {
    "origin_name": "FAR - FARGO",
    "flight_count": 83
  },
  {
    "origin_name": "AEX - ALEXANDRIA",
    "flight_count": 80
  },
  {
    "origin_name": "BPT - BEAUMONT/PORT ARTHUR",
    "flight_count": 77
  },
  {
    "origin_name": "STT - CHARLOTTE AMALIE",
    "flight_count": 76
  },
  {
    "origin_name": "PIE - ST PETERSBURG-CLEARWATER",
    "flight_count": 65
  },
  {
    "origin_name": "BZN - BOZEMAN",
    "flight_count": 62
  },
  {
    "origin_name": "FAT - FRESNO",
    "flight_count": 57
  },
  {
    "origin_name": "AVP - WILKES-BARRE/SCRANTON",
    "flight_count": 51
  },
  {
    "origin_name": "GRB - GREEN BAY",
    "flight_count": 47
  },
  {
    "origin_name": "EVV - EVANSVILLE",
    "flight_count": 42
  },
  {
    "origin_name": "MSO - MISSOULA",
    "flight_count": 41
  },
  {
    "origin_name": "LCH - LAKE CHARLES",
    "flight_count": 41
  },
  {
    "origin_name": "TOL - TOLEDO",
    "flight_count": 40
  },
  {
    "origin_name": "LAN - LANSING",
    "flight_count": 40
  },
  {
    "origin_name": "CID - CEDAR RAPIDS",
    "flight_count": 40
  },
  {
    "origin_name": "DLH - DULUTH",
    "flight_count": 40
  },
  {
    "origin_name": "GTR - COLUMBUS/W POINT/STARKVILL",
    "flight_count": 37
  },
  {
    "origin_name": "MEI - MERIDIAN",
    "flight_count": 37
  },
  {
    "origin_name": "FSD - SIOUX FALLS",
    "flight_count": 35
  },
  {
    "origin_name": "MTJ - MONTROSE",
    "flight_count": 32
  },
  {
    "origin_name": "CAK - AKRON",
    "flight_count": 32
  },
  {
    "origin_name": "CRW - CHARLESTON",
    "flight_count": 32
  },
  {
    "origin_name": "FWA - FORT WAYNE",
    "flight_count": 31
  },
  {
    "origin_name": "DAB - DAYTONA BEACH",
    "flight_count": 31
  },
  {
    "origin_name": "SBN - SOUTH BEND",
    "flight_count": 25
  },
  {
    "origin_name": "ATW - APPLETON",
    "flight_count": 24
  },
  {
    "origin_name": "KOA - KAILUA/KONA",
    "flight_count": 24
  },
  {
    "origin_name": "EGE - EAGLE",
    "flight_count": 24
  },
  {
    "origin_name": "RAP - RAPID CITY",
    "flight_count": 22
  },
  {
    "origin_name": "ERI - ERIE",
    "flight_count": 21
  },
  {
    "origin_name": "EFD - HOUSTON",
    "flight_count": 21
  },
  {
    "origin_name": "AZO - KALAMAZOO",
    "flight_count": 19
  },
  {
    "origin_name": "ACY - ATLANTIC CITY",
    "flight_count": 18
  },
  {
    "origin_name": "SBA - SANTA BARBARA",
    "flight_count": 18
  },
  {
    "origin_name": "GTF - GREAT FALLS",
    "flight_count": 18
  },
  {
    "origin_name": "MLI - MOLINE",
    "flight_count": 17
  },
  {
    "origin_name": "FCA - KALISPELL",
    "flight_count": 17
  },
  {
    "origin_name": "ACK - NANTUCKET",
    "flight_count": 15
  },
  {
    "origin_name": "BIL - BILLINGS",
    "flight_count": 15
  },
  {
    "origin_name": "MLU - MONROE",
    "flight_count": 15
  },
  {
    "origin_name": " - ",
    "flight_count": 14
  },
  {
    "origin_name": "LYH - LYNCHBURG",
    "flight_count": 14
  },
  {
    "origin_name": "BGM - BINGHAMTON",
    "flight_count": 13
  },
  {
    "origin_name": "SWF - NEWBURGH",
    "flight_count": 13
  },
  {
    "origin_name": "ORH - WORCESTER",
    "flight_count": 12
  },
  {
    "origin_name": "HDN - HAYDEN",
    "flight_count": 12
  },
  {
    "origin_name": "MLB - MELBOURNE",
    "flight_count": 10
  },
  {
    "origin_name": "CHO - CHARLOTTESVILLE",
    "flight_count": 9
  },
  {
    "origin_name": "BQN - AGUADILLA",
    "flight_count": 9
  },
  {
    "origin_name": "LNK - LINCOLN",
    "flight_count": 9
  },
  {
    "origin_name": "BFL - BAKERSFIELD",
    "flight_count": 9
  },
  {
    "origin_name": "CMI - CHAMPAIGN/URBANA",
    "flight_count": 8
  },
  {
    "origin_name": "GUC - GUNNISON",
    "flight_count": 7
  },
  {
    "origin_name": "ABY - ALBANY",
    "flight_count": 6
  },
  {
    "origin_name": "EUG - EUGENE",
    "flight_count": 5
  },
  {
    "origin_name": "DRO - DURANGO",
    "flight_count": 5
  },
  {
    "origin_name": "HLN - HELENA",
    "flight_count": 5
  },
  {
    "origin_name": "BIS - BISMARCK",
    "flight_count": 5
  },
  {
    "origin_name": "HTS - HUNTINGTON",
    "flight_count": 4
  },
  {
    "origin_name": "HVN - NEW HAVEN",
    "flight_count": 4
  },
  {
    "origin_name": "MRY - MONTEREY",
    "flight_count": 3
  },
  {
    "origin_name": "STX - CHRISTIANSTED",
    "flight_count": 3
  },
  {
    "origin_name": "EYW - KEY WEST",
    "flight_count": 3
  },
  {
    "origin_name": "PSE - PONCE",
    "flight_count": 3
  },
  {
    "origin_name": "VCT - VICTORIA",
    "flight_count": 3
  },
  {
    "origin_name": "BQK - BRUNSWICK",
    "flight_count": 2
  },
  {
    "origin_name": "TVC - TRAVERSE CITY",
    "flight_count": 2
  },
  {
    "origin_name": "MFR - MEDFORD",
    "flight_count": 1
  },
  {
    "origin_name": "FLO - FLORENCE",
    "flight_count": 1
  },
  {
    "origin_name": "LSE - LA CROSSE",
    "flight_count": 1
  },
  {
    "origin_name": "ELM - ELMIRA/CORNING",
    "flight_count": 1
  },
  {
    "origin_name": "PHF - NEWPORT NEWS",
    "flight_count": 1
  },
  {
    "origin_name": "ITH - ITHACA",
    "flight_count": 1
  }
]
SELECT 
   CONCAT(origin_0."code",' - ',origin_0."city") as "origin_name",
   COUNT( 1) as "flight_count"
FROM '../../documentation/data/flights.parquet' as flights
 LEFT JOIN '../../documentation/data/airports.parquet' AS origin_0
  ON origin_0."code"=flights."origin"
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Seats in the Air

Another way of measuring the busyness of an airport is to try and estimate the number of people that travel through the airport. Planes are of different sizes. If we count up all the seats in all the planes that have arrived, we can approximate the busyness. The measure seats_for_sale will give us the maximum number of people that could have landed there.

Notice Chicago has more people traveling through than Dallas-Fort Worth.

document
run: flights -> origin_name + seats_for_sale + flight_count
QUERY RESULTS
origin_​nameseats_​for_​saleflight_​count
ATL - ATLANTA2,686,01517,875
ORD - CHICAGO2,430,87814,214
DFW - DALLAS-FORT WORTH2,123,31417,782
LAX - LOS ANGELES1,936,87611,077
PHX - PHOENIX1,919,93612,476
LAS - LAS VEGAS1,814,37811,096
MSP - MINNEAPOLIS1,714,3139,762
DEN - DENVER1,462,3367,190
DTW - DETROIT1,341,4978,161
SEA - SEATTLE1,245,1087,010
LGA - NEW YORK1,227,3697,623
MCO - ORLANDO1,148,7026,790
PHL - PHILADELPHIA1,142,0357,708
CLT - CHARLOTTE1,115,7307,099
BWI - BALTIMORE1,064,3197,177
DCA - WASHINGTON975,3096,678
MDW - CHICAGO958,8966,611
BOS - BOSTON917,7485,797
SFO - SAN FRANCISCO848,5094,540
TPA - TAMPA825,9254,868
SAN - SAN DIEGO823,1005,075
IAD - WASHINGTON801,0833,885
OAK - OAKLAND775,1165,076
IAH - HOUSTON703,9546,623
PIT - PITTSBURGH676,9744,541
JFK - NEW YORK626,5553,689
FLL - FORT LAUDERDALE619,7043,619
PDX - PORTLAND608,3483,596
SJC - SAN JOSE601,2043,825
STL - ST LOUIS596,1884,089
EWR - NEWARK594,8685,174
BNA - NASHVILLE594,5254,287
MCI - KANSAS CITY583,2874,078
SLC - SALT LAKE CITY548,2782,741
SMF - SACRAMENTO546,2673,576
MSY - NEW ORLEANS519,5993,254
HOU - HOUSTON494,4993,430
MIA - MIAMI439,0472,387
CLE - CLEVELAND417,0975,127
ONT - ONTARIO411,4962,642
ABQ - ALBUQUERQUE411,3112,762
CVG - COVINGTON/CINCINNATI, OH388,1183,300
RDU - RALEIGH/DURHAM355,0472,444
MEM - MEMPHIS342,2592,242
PVD - PROVIDENCE341,7422,361
BDL - WINDSOR LOCKS336,5652,168
AUS - AUSTIN321,0702,091
RNO - RENO307,6841,992
IND - INDIANAPOLIS307,4662,226
SNA - SANTA ANA302,9561,919
BUR - BURBANK295,7471,952
SAT - SAN ANTONIO279,7911,865
JAX - JACKSONVILLE276,1281,599
PBI - WEST PALM BEACH248,7501,379
MHT - MANCHESTER239,0931,626
CMH - COLUMBUS238,8011,712
DAL - DALLAS238,5671,662
RSW - FORT MYERS226,8061,169
ELP - EL PASO214,0521,438
ISP - ISLIP171,4461,302
BUF - BUFFALO169,7961,246
TUS - TUCSON166,1621,062
BHM - BIRMINGHAM159,5621,200
ANC - ANCHORAGE158,055748
MKE - MILWAUKEE152,2171,132
GEG - SPOKANE144,575922
RIC - RICHMOND138,549946
ALB - ALBANY133,9821,108
OMA - OMAHA131,609946
SJU - SAN JUAN129,403645
LGB - LONG BEACH125,638661
SDF - LOUISVILLE123,1241,003
TUL - TULSA121,753984
BOI - BOISE117,813795
ORF - NORFOLK113,904888
OKC - OKLAHOMA CITY104,570905
ROC - ROCHESTER97,846733
LIT - LITTLE ROCK83,404853
HSV - HUNTSVILLE74,655607
SYR - SYRACUSE70,910597
MYR - MYRTLE BEACH69,135628
MDT - HARRISBURG66,779584
COS - COLORADO SPRINGS61,809426
PFN - PANAMA CITY59,086778
CHS - CHARLESTON57,840466
GRR - GRAND RAPIDS57,828513
AVL - ASHEVILLE57,624727
AGS - AUGUSTA56,508756
SAV - SAVANNAH56,323419
ABE - ALLENTOWN54,345510
GSO - GREENSBORO53,645470
CHA - CHATTANOOGA52,611697
CSG - COLUMBUS49,484654
JAN - JACKSON45,800356
CAE - COLUMBIA44,762376
LBB - LUBBOCK43,451425
TRI - BRISTOL/JOHNSON/KINGSPORT42,761566
MAF - MIDLAND41,588409
TYS - KNOXVILLE39,145464
PSP - PALM SPRINGS39,058240
HNL - HONOLULU38,498267
TLH - TALLAHASSEE38,374285
MGM - MONTGOMERY38,000500
GNV - GAINESVILLE35,720470
BTV - BURLINGTON35,047307
DAY - DAYTON30,449416
VPS - VALPARAISO30,250403
MSN - MADISON29,127271
AMA - AMARILLO28,588298
SRQ - SARASOTA/BRADENTON26,930192
PWM - PORTLAND26,890326
DHN - DOTHAN24,580324
MFE - MC ALLEN22,795154
BTR - BATON ROUGE21,359274
HRL - HARLINGEN20,877185
GPT - GULFPORT20,478278
LEX - LEXINGTON20,175305
FAI - FAIRBANKS19,668114
PNS - PENSACOLA19,510194
GSP - GREER18,898241
ACT - WACO18,734494
ILM - WILMINGTON18,373128
TYR - TYLER18,196480
CLL - COLLEGE STATION17,256454
SPS - WICHITA FALLS17,243457
SHV - SHREVEPORT16,253406
LAW - LAWTON16,031423
ILE - KILLEEN15,729416
JAC - JACKSON15,06386
VLD - VALDOSTA14,980200
STT - CHARLOTTE AMALIE14,79876
DSM - DES MOINES13,818254
ROA - ROANOKE13,684158
XNA - FAYETTEVILLE/SPRINGDALE/13,437319
OGG - KAHULUI13,086110
MOB - MOBILE13,022125
FAR - FARGO12,86983
CRP - CORPUS CHRISTI12,867181
ICT - WICHITA12,485183
ABI - ABILENE11,345297
HPN - WHITE PLAINS11,257315
BZN - BOZEMAN10,01562
FAT - FRESNO9,80457
GGG - LONGVIEW9,790258
PIE - ST PETERSBURG-CLEARWATER9,68565
FNT - FLINT9,00583
SJT - SAN ANGELO8,553223
TXK - TEXARKANA7,803207
LFT - LAFAYETTE7,788176
FSM - FORT SMITH7,764202
MCN - MACON7,532102
SGF - SPRINGFIELD7,363185
DLH - DULUTH6,65140
FAY - FAYETTEVILLE6,26483
GRK - FORT HOOD/KILLEEN6,101161
KOA - KAILUA/KONA6,05424
MSO - MISSOULA6,04541
AVP - WILKES-BARRE/SCRANTON5,71951
GRB - GREEN BAY5,30647
BRO - BROWNSVILLE5,26494
FSD - SIOUX FALLS4,74635
LRD - LAREDO4,479107
EGE - EAGLE4,27224
BGR - BANGOR3,71294
MTJ - MONTROSE3,70432
LAN - LANSING3,62240
BPT - BEAUMONT/PORT ARTHUR3,51977
AEX - ALEXANDRIA3,43980
RAP - RAPID CITY3,19422
TOL - TOLEDO2,62940
GTF - GREAT FALLS2,61018
EVV - EVANSVILLE2,58142
FCA - KALISPELL2,49517
BIL - BILLINGS2,31715
LCH - LAKE CHARLES2,23741
DAB - DAYTONA BEACH2,20431
ERI - ERIE2,18921
CAK - AKRON2,09532
BQN - AGUADILLA1,8009
LNK - LINCOLN1,7379
FWA - FORT WAYNE1,70531
CRW - CHARLESTON1,60832
HDN - HAYDEN1,47012
SBN - SOUTH BEND1,41525
CID - CEDAR RAPIDS1,40840
ATW - APPLETON1,32024
GTR - COLUMBUS/W POINT/STARKVILL1,22837
MEI - MERIDIAN1,18437
GUC - GUNNISON1,1717
EFD - HOUSTON1,13721
AZO - KALAMAZOO1,04519
ACY - ATLANTIC CITY99018
EUG - EUGENE9795
MLI - MOLINE93517
BGM - BINGHAMTON90313
- 77014
DRO - DURANGO7435
BIS - BISMARCK7255
SWF - NEWBURGH71513
ACK - NANTUCKET69915
PSE - PONCE6003
MLU - MONROE57715
MLB - MELBOURNE55010
STX - CHRISTIANSTED5373
MRY - MONTEREY5353
CHO - CHARLOTTESVILLE4959
BFL - BAKERSFIELD4959
LYH - LYNCHBURG49214
ORH - WORCESTER44412
CMI - CHAMPAIGN/URBANA4408
SBA - SANTA BARBARA42918
ABY - ALBANY3916
HLN - HELENA2755
HVN - NEW HAVEN2204
EYW - KEY WEST2103
HTS - HUNTINGTON1974
TVC - TRAVERSE CITY1892
MFR - MEDFORD1791
BQK - BRUNSWICK1522
ELM - ELMIRA/CORNING1491
ITH - ITHACA1491
VCT - VICTORIA1473
FLO - FLORENCE761
PHF - NEWPORT NEWS551
LSE - LA CROSSE221
[
  {
    "origin_name": "ATL - ATLANTA",
    "seats_for_sale": 2686015,
    "flight_count": 17875
  },
  {
    "origin_name": "ORD - CHICAGO",
    "seats_for_sale": 2430878,
    "flight_count": 14214
  },
  {
    "origin_name": "DFW - DALLAS-FORT WORTH",
    "seats_for_sale": 2123314,
    "flight_count": 17782
  },
  {
    "origin_name": "LAX - LOS ANGELES",
    "seats_for_sale": 1936876,
    "flight_count": 11077
  },
  {
    "origin_name": "PHX - PHOENIX",
    "seats_for_sale": 1919936,
    "flight_count": 12476
  },
  {
    "origin_name": "LAS - LAS VEGAS",
    "seats_for_sale": 1814378,
    "flight_count": 11096
  },
  {
    "origin_name": "MSP - MINNEAPOLIS",
    "seats_for_sale": 1714313,
    "flight_count": 9762
  },
  {
    "origin_name": "DEN - DENVER",
    "seats_for_sale": 1462336,
    "flight_count": 7190
  },
  {
    "origin_name": "DTW - DETROIT",
    "seats_for_sale": 1341497,
    "flight_count": 8161
  },
  {
    "origin_name": "SEA - SEATTLE",
    "seats_for_sale": 1245108,
    "flight_count": 7010
  },
  {
    "origin_name": "LGA - NEW YORK",
    "seats_for_sale": 1227369,
    "flight_count": 7623
  },
  {
    "origin_name": "MCO - ORLANDO",
    "seats_for_sale": 1148702,
    "flight_count": 6790
  },
  {
    "origin_name": "PHL - PHILADELPHIA",
    "seats_for_sale": 1142035,
    "flight_count": 7708
  },
  {
    "origin_name": "CLT - CHARLOTTE",
    "seats_for_sale": 1115730,
    "flight_count": 7099
  },
  {
    "origin_name": "BWI - BALTIMORE",
    "seats_for_sale": 1064319,
    "flight_count": 7177
  },
  {
    "origin_name": "DCA - WASHINGTON",
    "seats_for_sale": 975309,
    "flight_count": 6678
  },
  {
    "origin_name": "MDW - CHICAGO",
    "seats_for_sale": 958896,
    "flight_count": 6611
  },
  {
    "origin_name": "BOS - BOSTON",
    "seats_for_sale": 917748,
    "flight_count": 5797
  },
  {
    "origin_name": "SFO - SAN FRANCISCO",
    "seats_for_sale": 848509,
    "flight_count": 4540
  },
  {
    "origin_name": "TPA - TAMPA",
    "seats_for_sale": 825925,
    "flight_count": 4868
  },
  {
    "origin_name": "SAN - SAN DIEGO",
    "seats_for_sale": 823100,
    "flight_count": 5075
  },
  {
    "origin_name": "IAD - WASHINGTON",
    "seats_for_sale": 801083,
    "flight_count": 3885
  },
  {
    "origin_name": "OAK - OAKLAND",
    "seats_for_sale": 775116,
    "flight_count": 5076
  },
  {
    "origin_name": "IAH - HOUSTON",
    "seats_for_sale": 703954,
    "flight_count": 6623
  },
  {
    "origin_name": "PIT - PITTSBURGH",
    "seats_for_sale": 676974,
    "flight_count": 4541
  },
  {
    "origin_name": "JFK - NEW YORK",
    "seats_for_sale": 626555,
    "flight_count": 3689
  },
  {
    "origin_name": "FLL - FORT LAUDERDALE",
    "seats_for_sale": 619704,
    "flight_count": 3619
  },
  {
    "origin_name": "PDX - PORTLAND",
    "seats_for_sale": 608348,
    "flight_count": 3596
  },
  {
    "origin_name": "SJC - SAN JOSE",
    "seats_for_sale": 601204,
    "flight_count": 3825
  },
  {
    "origin_name": "STL - ST LOUIS",
    "seats_for_sale": 596188,
    "flight_count": 4089
  },
  {
    "origin_name": "EWR - NEWARK",
    "seats_for_sale": 594868,
    "flight_count": 5174
  },
  {
    "origin_name": "BNA - NASHVILLE",
    "seats_for_sale": 594525,
    "flight_count": 4287
  },
  {
    "origin_name": "MCI - KANSAS CITY",
    "seats_for_sale": 583287,
    "flight_count": 4078
  },
  {
    "origin_name": "SLC - SALT LAKE CITY",
    "seats_for_sale": 548278,
    "flight_count": 2741
  },
  {
    "origin_name": "SMF - SACRAMENTO",
    "seats_for_sale": 546267,
    "flight_count": 3576
  },
  {
    "origin_name": "MSY - NEW ORLEANS",
    "seats_for_sale": 519599,
    "flight_count": 3254
  },
  {
    "origin_name": "HOU - HOUSTON",
    "seats_for_sale": 494499,
    "flight_count": 3430
  },
  {
    "origin_name": "MIA - MIAMI",
    "seats_for_sale": 439047,
    "flight_count": 2387
  },
  {
    "origin_name": "CLE - CLEVELAND",
    "seats_for_sale": 417097,
    "flight_count": 5127
  },
  {
    "origin_name": "ONT - ONTARIO",
    "seats_for_sale": 411496,
    "flight_count": 2642
  },
  {
    "origin_name": "ABQ - ALBUQUERQUE",
    "seats_for_sale": 411311,
    "flight_count": 2762
  },
  {
    "origin_name": "CVG - COVINGTON/CINCINNATI, OH",
    "seats_for_sale": 388118,
    "flight_count": 3300
  },
  {
    "origin_name": "RDU - RALEIGH/DURHAM",
    "seats_for_sale": 355047,
    "flight_count": 2444
  },
  {
    "origin_name": "MEM - MEMPHIS",
    "seats_for_sale": 342259,
    "flight_count": 2242
  },
  {
    "origin_name": "PVD - PROVIDENCE",
    "seats_for_sale": 341742,
    "flight_count": 2361
  },
  {
    "origin_name": "BDL - WINDSOR LOCKS",
    "seats_for_sale": 336565,
    "flight_count": 2168
  },
  {
    "origin_name": "AUS - AUSTIN",
    "seats_for_sale": 321070,
    "flight_count": 2091
  },
  {
    "origin_name": "RNO - RENO",
    "seats_for_sale": 307684,
    "flight_count": 1992
  },
  {
    "origin_name": "IND - INDIANAPOLIS",
    "seats_for_sale": 307466,
    "flight_count": 2226
  },
  {
    "origin_name": "SNA - SANTA ANA",
    "seats_for_sale": 302956,
    "flight_count": 1919
  },
  {
    "origin_name": "BUR - BURBANK",
    "seats_for_sale": 295747,
    "flight_count": 1952
  },
  {
    "origin_name": "SAT - SAN ANTONIO",
    "seats_for_sale": 279791,
    "flight_count": 1865
  },
  {
    "origin_name": "JAX - JACKSONVILLE",
    "seats_for_sale": 276128,
    "flight_count": 1599
  },
  {
    "origin_name": "PBI - WEST PALM BEACH",
    "seats_for_sale": 248750,
    "flight_count": 1379
  },
  {
    "origin_name": "MHT - MANCHESTER",
    "seats_for_sale": 239093,
    "flight_count": 1626
  },
  {
    "origin_name": "CMH - COLUMBUS",
    "seats_for_sale": 238801,
    "flight_count": 1712
  },
  {
    "origin_name": "DAL - DALLAS",
    "seats_for_sale": 238567,
    "flight_count": 1662
  },
  {
    "origin_name": "RSW - FORT MYERS",
    "seats_for_sale": 226806,
    "flight_count": 1169
  },
  {
    "origin_name": "ELP - EL PASO",
    "seats_for_sale": 214052,
    "flight_count": 1438
  },
  {
    "origin_name": "ISP - ISLIP",
    "seats_for_sale": 171446,
    "flight_count": 1302
  },
  {
    "origin_name": "BUF - BUFFALO",
    "seats_for_sale": 169796,
    "flight_count": 1246
  },
  {
    "origin_name": "TUS - TUCSON",
    "seats_for_sale": 166162,
    "flight_count": 1062
  },
  {
    "origin_name": "BHM - BIRMINGHAM",
    "seats_for_sale": 159562,
    "flight_count": 1200
  },
  {
    "origin_name": "ANC - ANCHORAGE",
    "seats_for_sale": 158055,
    "flight_count": 748
  },
  {
    "origin_name": "MKE - MILWAUKEE",
    "seats_for_sale": 152217,
    "flight_count": 1132
  },
  {
    "origin_name": "GEG - SPOKANE",
    "seats_for_sale": 144575,
    "flight_count": 922
  },
  {
    "origin_name": "RIC - RICHMOND",
    "seats_for_sale": 138549,
    "flight_count": 946
  },
  {
    "origin_name": "ALB - ALBANY",
    "seats_for_sale": 133982,
    "flight_count": 1108
  },
  {
    "origin_name": "OMA - OMAHA",
    "seats_for_sale": 131609,
    "flight_count": 946
  },
  {
    "origin_name": "SJU - SAN JUAN",
    "seats_for_sale": 129403,
    "flight_count": 645
  },
  {
    "origin_name": "LGB - LONG BEACH",
    "seats_for_sale": 125638,
    "flight_count": 661
  },
  {
    "origin_name": "SDF - LOUISVILLE",
    "seats_for_sale": 123124,
    "flight_count": 1003
  },
  {
    "origin_name": "TUL - TULSA",
    "seats_for_sale": 121753,
    "flight_count": 984
  },
  {
    "origin_name": "BOI - BOISE",
    "seats_for_sale": 117813,
    "flight_count": 795
  },
  {
    "origin_name": "ORF - NORFOLK",
    "seats_for_sale": 113904,
    "flight_count": 888
  },
  {
    "origin_name": "OKC - OKLAHOMA CITY",
    "seats_for_sale": 104570,
    "flight_count": 905
  },
  {
    "origin_name": "ROC - ROCHESTER",
    "seats_for_sale": 97846,
    "flight_count": 733
  },
  {
    "origin_name": "LIT - LITTLE ROCK",
    "seats_for_sale": 83404,
    "flight_count": 853
  },
  {
    "origin_name": "HSV - HUNTSVILLE",
    "seats_for_sale": 74655,
    "flight_count": 607
  },
  {
    "origin_name": "SYR - SYRACUSE",
    "seats_for_sale": 70910,
    "flight_count": 597
  },
  {
    "origin_name": "MYR - MYRTLE BEACH",
    "seats_for_sale": 69135,
    "flight_count": 628
  },
  {
    "origin_name": "MDT - HARRISBURG",
    "seats_for_sale": 66779,
    "flight_count": 584
  },
  {
    "origin_name": "COS - COLORADO SPRINGS",
    "seats_for_sale": 61809,
    "flight_count": 426
  },
  {
    "origin_name": "PFN - PANAMA CITY",
    "seats_for_sale": 59086,
    "flight_count": 778
  },
  {
    "origin_name": "CHS - CHARLESTON",
    "seats_for_sale": 57840,
    "flight_count": 466
  },
  {
    "origin_name": "GRR - GRAND RAPIDS",
    "seats_for_sale": 57828,
    "flight_count": 513
  },
  {
    "origin_name": "AVL - ASHEVILLE",
    "seats_for_sale": 57624,
    "flight_count": 727
  },
  {
    "origin_name": "AGS - AUGUSTA",
    "seats_for_sale": 56508,
    "flight_count": 756
  },
  {
    "origin_name": "SAV - SAVANNAH",
    "seats_for_sale": 56323,
    "flight_count": 419
  },
  {
    "origin_name": "ABE - ALLENTOWN",
    "seats_for_sale": 54345,
    "flight_count": 510
  },
  {
    "origin_name": "GSO - GREENSBORO",
    "seats_for_sale": 53645,
    "flight_count": 470
  },
  {
    "origin_name": "CHA - CHATTANOOGA",
    "seats_for_sale": 52611,
    "flight_count": 697
  },
  {
    "origin_name": "CSG - COLUMBUS",
    "seats_for_sale": 49484,
    "flight_count": 654
  },
  {
    "origin_name": "JAN - JACKSON",
    "seats_for_sale": 45800,
    "flight_count": 356
  },
  {
    "origin_name": "CAE - COLUMBIA",
    "seats_for_sale": 44762,
    "flight_count": 376
  },
  {
    "origin_name": "LBB - LUBBOCK",
    "seats_for_sale": 43451,
    "flight_count": 425
  },
  {
    "origin_name": "TRI - BRISTOL/JOHNSON/KINGSPORT",
    "seats_for_sale": 42761,
    "flight_count": 566
  },
  {
    "origin_name": "MAF - MIDLAND",
    "seats_for_sale": 41588,
    "flight_count": 409
  },
  {
    "origin_name": "TYS - KNOXVILLE",
    "seats_for_sale": 39145,
    "flight_count": 464
  },
  {
    "origin_name": "PSP - PALM SPRINGS",
    "seats_for_sale": 39058,
    "flight_count": 240
  },
  {
    "origin_name": "HNL - HONOLULU",
    "seats_for_sale": 38498,
    "flight_count": 267
  },
  {
    "origin_name": "TLH - TALLAHASSEE",
    "seats_for_sale": 38374,
    "flight_count": 285
  },
  {
    "origin_name": "MGM - MONTGOMERY",
    "seats_for_sale": 38000,
    "flight_count": 500
  },
  {
    "origin_name": "GNV - GAINESVILLE",
    "seats_for_sale": 35720,
    "flight_count": 470
  },
  {
    "origin_name": "BTV - BURLINGTON",
    "seats_for_sale": 35047,
    "flight_count": 307
  },
  {
    "origin_name": "DAY - DAYTON",
    "seats_for_sale": 30449,
    "flight_count": 416
  },
  {
    "origin_name": "VPS - VALPARAISO",
    "seats_for_sale": 30250,
    "flight_count": 403
  },
  {
    "origin_name": "MSN - MADISON",
    "seats_for_sale": 29127,
    "flight_count": 271
  },
  {
    "origin_name": "AMA - AMARILLO",
    "seats_for_sale": 28588,
    "flight_count": 298
  },
  {
    "origin_name": "SRQ - SARASOTA/BRADENTON",
    "seats_for_sale": 26930,
    "flight_count": 192
  },
  {
    "origin_name": "PWM - PORTLAND",
    "seats_for_sale": 26890,
    "flight_count": 326
  },
  {
    "origin_name": "DHN - DOTHAN",
    "seats_for_sale": 24580,
    "flight_count": 324
  },
  {
    "origin_name": "MFE - MC ALLEN",
    "seats_for_sale": 22795,
    "flight_count": 154
  },
  {
    "origin_name": "BTR - BATON ROUGE",
    "seats_for_sale": 21359,
    "flight_count": 274
  },
  {
    "origin_name": "HRL - HARLINGEN",
    "seats_for_sale": 20877,
    "flight_count": 185
  },
  {
    "origin_name": "GPT - GULFPORT",
    "seats_for_sale": 20478,
    "flight_count": 278
  },
  {
    "origin_name": "LEX - LEXINGTON",
    "seats_for_sale": 20175,
    "flight_count": 305
  },
  {
    "origin_name": "FAI - FAIRBANKS",
    "seats_for_sale": 19668,
    "flight_count": 114
  },
  {
    "origin_name": "PNS - PENSACOLA",
    "seats_for_sale": 19510,
    "flight_count": 194
  },
  {
    "origin_name": "GSP - GREER",
    "seats_for_sale": 18898,
    "flight_count": 241
  },
  {
    "origin_name": "ACT - WACO",
    "seats_for_sale": 18734,
    "flight_count": 494
  },
  {
    "origin_name": "ILM - WILMINGTON",
    "seats_for_sale": 18373,
    "flight_count": 128
  },
  {
    "origin_name": "TYR - TYLER",
    "seats_for_sale": 18196,
    "flight_count": 480
  },
  {
    "origin_name": "CLL - COLLEGE STATION",
    "seats_for_sale": 17256,
    "flight_count": 454
  },
  {
    "origin_name": "SPS - WICHITA FALLS",
    "seats_for_sale": 17243,
    "flight_count": 457
  },
  {
    "origin_name": "SHV - SHREVEPORT",
    "seats_for_sale": 16253,
    "flight_count": 406
  },
  {
    "origin_name": "LAW - LAWTON",
    "seats_for_sale": 16031,
    "flight_count": 423
  },
  {
    "origin_name": "ILE - KILLEEN",
    "seats_for_sale": 15729,
    "flight_count": 416
  },
  {
    "origin_name": "JAC - JACKSON",
    "seats_for_sale": 15063,
    "flight_count": 86
  },
  {
    "origin_name": "VLD - VALDOSTA",
    "seats_for_sale": 14980,
    "flight_count": 200
  },
  {
    "origin_name": "STT - CHARLOTTE AMALIE",
    "seats_for_sale": 14798,
    "flight_count": 76
  },
  {
    "origin_name": "DSM - DES MOINES",
    "seats_for_sale": 13818,
    "flight_count": 254
  },
  {
    "origin_name": "ROA - ROANOKE",
    "seats_for_sale": 13684,
    "flight_count": 158
  },
  {
    "origin_name": "XNA - FAYETTEVILLE/SPRINGDALE/",
    "seats_for_sale": 13437,
    "flight_count": 319
  },
  {
    "origin_name": "OGG - KAHULUI",
    "seats_for_sale": 13086,
    "flight_count": 110
  },
  {
    "origin_name": "MOB - MOBILE",
    "seats_for_sale": 13022,
    "flight_count": 125
  },
  {
    "origin_name": "FAR - FARGO",
    "seats_for_sale": 12869,
    "flight_count": 83
  },
  {
    "origin_name": "CRP - CORPUS CHRISTI",
    "seats_for_sale": 12867,
    "flight_count": 181
  },
  {
    "origin_name": "ICT - WICHITA",
    "seats_for_sale": 12485,
    "flight_count": 183
  },
  {
    "origin_name": "ABI - ABILENE",
    "seats_for_sale": 11345,
    "flight_count": 297
  },
  {
    "origin_name": "HPN - WHITE PLAINS",
    "seats_for_sale": 11257,
    "flight_count": 315
  },
  {
    "origin_name": "BZN - BOZEMAN",
    "seats_for_sale": 10015,
    "flight_count": 62
  },
  {
    "origin_name": "FAT - FRESNO",
    "seats_for_sale": 9804,
    "flight_count": 57
  },
  {
    "origin_name": "GGG - LONGVIEW",
    "seats_for_sale": 9790,
    "flight_count": 258
  },
  {
    "origin_name": "PIE - ST PETERSBURG-CLEARWATER",
    "seats_for_sale": 9685,
    "flight_count": 65
  },
  {
    "origin_name": "FNT - FLINT",
    "seats_for_sale": 9005,
    "flight_count": 83
  },
  {
    "origin_name": "SJT - SAN ANGELO",
    "seats_for_sale": 8553,
    "flight_count": 223
  },
  {
    "origin_name": "TXK - TEXARKANA",
    "seats_for_sale": 7803,
    "flight_count": 207
  },
  {
    "origin_name": "LFT - LAFAYETTE",
    "seats_for_sale": 7788,
    "flight_count": 176
  },
  {
    "origin_name": "FSM - FORT SMITH",
    "seats_for_sale": 7764,
    "flight_count": 202
  },
  {
    "origin_name": "MCN - MACON",
    "seats_for_sale": 7532,
    "flight_count": 102
  },
  {
    "origin_name": "SGF - SPRINGFIELD",
    "seats_for_sale": 7363,
    "flight_count": 185
  },
  {
    "origin_name": "DLH - DULUTH",
    "seats_for_sale": 6651,
    "flight_count": 40
  },
  {
    "origin_name": "FAY - FAYETTEVILLE",
    "seats_for_sale": 6264,
    "flight_count": 83
  },
  {
    "origin_name": "GRK - FORT HOOD/KILLEEN",
    "seats_for_sale": 6101,
    "flight_count": 161
  },
  {
    "origin_name": "KOA - KAILUA/KONA",
    "seats_for_sale": 6054,
    "flight_count": 24
  },
  {
    "origin_name": "MSO - MISSOULA",
    "seats_for_sale": 6045,
    "flight_count": 41
  },
  {
    "origin_name": "AVP - WILKES-BARRE/SCRANTON",
    "seats_for_sale": 5719,
    "flight_count": 51
  },
  {
    "origin_name": "GRB - GREEN BAY",
    "seats_for_sale": 5306,
    "flight_count": 47
  },
  {
    "origin_name": "BRO - BROWNSVILLE",
    "seats_for_sale": 5264,
    "flight_count": 94
  },
  {
    "origin_name": "FSD - SIOUX FALLS",
    "seats_for_sale": 4746,
    "flight_count": 35
  },
  {
    "origin_name": "LRD - LAREDO",
    "seats_for_sale": 4479,
    "flight_count": 107
  },
  {
    "origin_name": "EGE - EAGLE",
    "seats_for_sale": 4272,
    "flight_count": 24
  },
  {
    "origin_name": "BGR - BANGOR",
    "seats_for_sale": 3712,
    "flight_count": 94
  },
  {
    "origin_name": "MTJ - MONTROSE",
    "seats_for_sale": 3704,
    "flight_count": 32
  },
  {
    "origin_name": "LAN - LANSING",
    "seats_for_sale": 3622,
    "flight_count": 40
  },
  {
    "origin_name": "BPT - BEAUMONT/PORT ARTHUR",
    "seats_for_sale": 3519,
    "flight_count": 77
  },
  {
    "origin_name": "AEX - ALEXANDRIA",
    "seats_for_sale": 3439,
    "flight_count": 80
  },
  {
    "origin_name": "RAP - RAPID CITY",
    "seats_for_sale": 3194,
    "flight_count": 22
  },
  {
    "origin_name": "TOL - TOLEDO",
    "seats_for_sale": 2629,
    "flight_count": 40
  },
  {
    "origin_name": "GTF - GREAT FALLS",
    "seats_for_sale": 2610,
    "flight_count": 18
  },
  {
    "origin_name": "EVV - EVANSVILLE",
    "seats_for_sale": 2581,
    "flight_count": 42
  },
  {
    "origin_name": "FCA - KALISPELL",
    "seats_for_sale": 2495,
    "flight_count": 17
  },
  {
    "origin_name": "BIL - BILLINGS",
    "seats_for_sale": 2317,
    "flight_count": 15
  },
  {
    "origin_name": "LCH - LAKE CHARLES",
    "seats_for_sale": 2237,
    "flight_count": 41
  },
  {
    "origin_name": "DAB - DAYTONA BEACH",
    "seats_for_sale": 2204,
    "flight_count": 31
  },
  {
    "origin_name": "ERI - ERIE",
    "seats_for_sale": 2189,
    "flight_count": 21
  },
  {
    "origin_name": "CAK - AKRON",
    "seats_for_sale": 2095,
    "flight_count": 32
  },
  {
    "origin_name": "BQN - AGUADILLA",
    "seats_for_sale": 1800,
    "flight_count": 9
  },
  {
    "origin_name": "LNK - LINCOLN",
    "seats_for_sale": 1737,
    "flight_count": 9
  },
  {
    "origin_name": "FWA - FORT WAYNE",
    "seats_for_sale": 1705,
    "flight_count": 31
  },
  {
    "origin_name": "CRW - CHARLESTON",
    "seats_for_sale": 1608,
    "flight_count": 32
  },
  {
    "origin_name": "HDN - HAYDEN",
    "seats_for_sale": 1470,
    "flight_count": 12
  },
  {
    "origin_name": "SBN - SOUTH BEND",
    "seats_for_sale": 1415,
    "flight_count": 25
  },
  {
    "origin_name": "CID - CEDAR RAPIDS",
    "seats_for_sale": 1408,
    "flight_count": 40
  },
  {
    "origin_name": "ATW - APPLETON",
    "seats_for_sale": 1320,
    "flight_count": 24
  },
  {
    "origin_name": "GTR - COLUMBUS/W POINT/STARKVILL",
    "seats_for_sale": 1228,
    "flight_count": 37
  },
  {
    "origin_name": "MEI - MERIDIAN",
    "seats_for_sale": 1184,
    "flight_count": 37
  },
  {
    "origin_name": "GUC - GUNNISON",
    "seats_for_sale": 1171,
    "flight_count": 7
  },
  {
    "origin_name": "EFD - HOUSTON",
    "seats_for_sale": 1137,
    "flight_count": 21
  },
  {
    "origin_name": "AZO - KALAMAZOO",
    "seats_for_sale": 1045,
    "flight_count": 19
  },
  {
    "origin_name": "ACY - ATLANTIC CITY",
    "seats_for_sale": 990,
    "flight_count": 18
  },
  {
    "origin_name": "EUG - EUGENE",
    "seats_for_sale": 979,
    "flight_count": 5
  },
  {
    "origin_name": "MLI - MOLINE",
    "seats_for_sale": 935,
    "flight_count": 17
  },
  {
    "origin_name": "BGM - BINGHAMTON",
    "seats_for_sale": 903,
    "flight_count": 13
  },
  {
    "origin_name": " - ",
    "seats_for_sale": 770,
    "flight_count": 14
  },
  {
    "origin_name": "DRO - DURANGO",
    "seats_for_sale": 743,
    "flight_count": 5
  },
  {
    "origin_name": "BIS - BISMARCK",
    "seats_for_sale": 725,
    "flight_count": 5
  },
  {
    "origin_name": "SWF - NEWBURGH",
    "seats_for_sale": 715,
    "flight_count": 13
  },
  {
    "origin_name": "ACK - NANTUCKET",
    "seats_for_sale": 699,
    "flight_count": 15
  },
  {
    "origin_name": "PSE - PONCE",
    "seats_for_sale": 600,
    "flight_count": 3
  },
  {
    "origin_name": "MLU - MONROE",
    "seats_for_sale": 577,
    "flight_count": 15
  },
  {
    "origin_name": "MLB - MELBOURNE",
    "seats_for_sale": 550,
    "flight_count": 10
  },
  {
    "origin_name": "STX - CHRISTIANSTED",
    "seats_for_sale": 537,
    "flight_count": 3
  },
  {
    "origin_name": "MRY - MONTEREY",
    "seats_for_sale": 535,
    "flight_count": 3
  },
  {
    "origin_name": "CHO - CHARLOTTESVILLE",
    "seats_for_sale": 495,
    "flight_count": 9
  },
  {
    "origin_name": "BFL - BAKERSFIELD",
    "seats_for_sale": 495,
    "flight_count": 9
  },
  {
    "origin_name": "LYH - LYNCHBURG",
    "seats_for_sale": 492,
    "flight_count": 14
  },
  {
    "origin_name": "ORH - WORCESTER",
    "seats_for_sale": 444,
    "flight_count": 12
  },
  {
    "origin_name": "CMI - CHAMPAIGN/URBANA",
    "seats_for_sale": 440,
    "flight_count": 8
  },
  {
    "origin_name": "SBA - SANTA BARBARA",
    "seats_for_sale": 429,
    "flight_count": 18
  },
  {
    "origin_name": "ABY - ALBANY",
    "seats_for_sale": 391,
    "flight_count": 6
  },
  {
    "origin_name": "HLN - HELENA",
    "seats_for_sale": 275,
    "flight_count": 5
  },
  {
    "origin_name": "HVN - NEW HAVEN",
    "seats_for_sale": 220,
    "flight_count": 4
  },
  {
    "origin_name": "EYW - KEY WEST",
    "seats_for_sale": 210,
    "flight_count": 3
  },
  {
    "origin_name": "HTS - HUNTINGTON",
    "seats_for_sale": 197,
    "flight_count": 4
  },
  {
    "origin_name": "TVC - TRAVERSE CITY",
    "seats_for_sale": 189,
    "flight_count": 2
  },
  {
    "origin_name": "MFR - MEDFORD",
    "seats_for_sale": 179,
    "flight_count": 1
  },
  {
    "origin_name": "BQK - BRUNSWICK",
    "seats_for_sale": 152,
    "flight_count": 2
  },
  {
    "origin_name": "ELM - ELMIRA/CORNING",
    "seats_for_sale": 149,
    "flight_count": 1
  },
  {
    "origin_name": "ITH - ITHACA",
    "seats_for_sale": 149,
    "flight_count": 1
  },
  {
    "origin_name": "VCT - VICTORIA",
    "seats_for_sale": 147,
    "flight_count": 3
  },
  {
    "origin_name": "FLO - FLORENCE",
    "seats_for_sale": 76,
    "flight_count": 1
  },
  {
    "origin_name": "PHF - NEWPORT NEWS",
    "seats_for_sale": 55,
    "flight_count": 1
  },
  {
    "origin_name": "LSE - LA CROSSE",
    "seats_for_sale": 22,
    "flight_count": 1
  }
]
SELECT 
   CONCAT(origin_0."code",' - ',origin_0."city") as "origin_name",
   COALESCE(SUM(aircraft_models_0."seats"),0) as "seats_for_sale",
   COUNT( 1) as "flight_count"
FROM '../../documentation/data/flights.parquet' as flights
 LEFT JOIN '../../documentation/data/airports.parquet' AS origin_0
  ON origin_0."code"=flights."origin"
 LEFT JOIN '../../documentation/data/aircraft.parquet' AS aircraft_0
  ON aircraft_0."tail_num"=flights."tail_num"
 LEFT JOIN '../../documentation/data/aircraft_models.parquet' AS aircraft_models_0
  ON aircraft_models_0."aircraft_model_code"=aircraft_0."aircraft_model_code"
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Filtering

Isolating the data to analyze is a big part of working with data. Let's limit our analysis to California airports. We've reformated the query. In Malloy, spaces and newlines are the same thing.

document
run: flights -> 
  origin_name 
  + seats_for_sale
  + flight_count
  + {where: origin.state='CA'}
QUERY RESULTS
origin_​nameseats_​for_​saleflight_​count
LAX - LOS ANGELES1,936,87611,077
SFO - SAN FRANCISCO848,5094,540
SAN - SAN DIEGO823,1005,075
OAK - OAKLAND775,1165,076
SJC - SAN JOSE601,2043,825
SMF - SACRAMENTO546,2673,576
ONT - ONTARIO411,4962,642
SNA - SANTA ANA302,9561,919
BUR - BURBANK295,7471,952
LGB - LONG BEACH125,638661
PSP - PALM SPRINGS39,058240
FAT - FRESNO9,80457
MRY - MONTEREY5353
BFL - BAKERSFIELD4959
SBA - SANTA BARBARA42918
[
  {
    "origin_name": "LAX - LOS ANGELES",
    "seats_for_sale": 1936876,
    "flight_count": 11077
  },
  {
    "origin_name": "SFO - SAN FRANCISCO",
    "seats_for_sale": 848509,
    "flight_count": 4540
  },
  {
    "origin_name": "SAN - SAN DIEGO",
    "seats_for_sale": 823100,
    "flight_count": 5075
  },
  {
    "origin_name": "OAK - OAKLAND",
    "seats_for_sale": 775116,
    "flight_count": 5076
  },
  {
    "origin_name": "SJC - SAN JOSE",
    "seats_for_sale": 601204,
    "flight_count": 3825
  },
  {
    "origin_name": "SMF - SACRAMENTO",
    "seats_for_sale": 546267,
    "flight_count": 3576
  },
  {
    "origin_name": "ONT - ONTARIO",
    "seats_for_sale": 411496,
    "flight_count": 2642
  },
  {
    "origin_name": "SNA - SANTA ANA",
    "seats_for_sale": 302956,
    "flight_count": 1919
  },
  {
    "origin_name": "BUR - BURBANK",
    "seats_for_sale": 295747,
    "flight_count": 1952
  },
  {
    "origin_name": "LGB - LONG BEACH",
    "seats_for_sale": 125638,
    "flight_count": 661
  },
  {
    "origin_name": "PSP - PALM SPRINGS",
    "seats_for_sale": 39058,
    "flight_count": 240
  },
  {
    "origin_name": "FAT - FRESNO",
    "seats_for_sale": 9804,
    "flight_count": 57
  },
  {
    "origin_name": "MRY - MONTEREY",
    "seats_for_sale": 535,
    "flight_count": 3
  },
  {
    "origin_name": "BFL - BAKERSFIELD",
    "seats_for_sale": 495,
    "flight_count": 9
  },
  {
    "origin_name": "SBA - SANTA BARBARA",
    "seats_for_sale": 429,
    "flight_count": 18
  }
]
SELECT 
   CONCAT(origin_0."code",' - ',origin_0."city") as "origin_name",
   COALESCE(SUM(aircraft_models_0."seats"),0) as "seats_for_sale",
   COUNT( 1) as "flight_count"
FROM '../../documentation/data/flights.parquet' as flights
 LEFT JOIN '../../documentation/data/airports.parquet' AS origin_0
  ON origin_0."code"=flights."origin"
 LEFT JOIN '../../documentation/data/aircraft.parquet' AS aircraft_0
  ON aircraft_0."tail_num"=flights."tail_num"
 LEFT JOIN '../../documentation/data/aircraft_models.parquet' AS aircraft_models_0
  ON aircraft_models_0."aircraft_model_code"=aircraft_0."aircraft_model_code"
WHERE origin_0."state"='CA'
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Adding your own measures

The Malloy semantic data model provides most of what we would like to calculate, but we can provide our own calculations in our queries. This model doesn't contain an average_distance, so we can compute this ourselves.

It looks like Jetblue, on average, has the longest flights.

You may also notice that by default, Malloy sorts results in descending order by the first measure.

document
run: flights -> 
  carrier_name
  + {aggregate: avg_distance is distance.avg()}
  + flight_count 
QUERY RESULTS
carrier_​nameavg_​distanceflight_​count
Jetblue1,332.5674,842
United1,187.01132,757
American1,089.88334,577
Northwest993.9433,580
ATA872.1493,033
Alaska836.6798,453
Continental811.6787,139
Delta670.64732,130
America West660.6889,750
USAir629.50537,683
Southwest615.4288,751
Continental Express477.58916,074
Comair451.8914,420
American Eagle267.9115,869
Atlantic Southeast201.17815,769
[
  {
    "carrier_name": "Jetblue",
    "avg_distance": 1332.5667079719124,
    "flight_count": 4842
  },
  {
    "carrier_name": "United",
    "avg_distance": 1187.0114479347926,
    "flight_count": 32757
  },
  {
    "carrier_name": "American",
    "avg_distance": 1089.8830147207682,
    "flight_count": 34577
  },
  {
    "carrier_name": "Northwest",
    "avg_distance": 993.9399344848124,
    "flight_count": 33580
  },
  {
    "carrier_name": "ATA",
    "avg_distance": 872.1486976590834,
    "flight_count": 3033
  },
  {
    "carrier_name": "Alaska",
    "avg_distance": 836.679403761978,
    "flight_count": 8453
  },
  {
    "carrier_name": "Continental",
    "avg_distance": 811.6783863286174,
    "flight_count": 7139
  },
  {
    "carrier_name": "Delta",
    "avg_distance": 670.6465608465609,
    "flight_count": 32130
  },
  {
    "carrier_name": "America West",
    "avg_distance": 660.6878974358974,
    "flight_count": 9750
  },
  {
    "carrier_name": "USAir",
    "avg_distance": 629.5051349414855,
    "flight_count": 37683
  },
  {
    "carrier_name": "Southwest",
    "avg_distance": 615.4201304774031,
    "flight_count": 88751
  },
  {
    "carrier_name": "Continental Express",
    "avg_distance": 477.58902575587905,
    "flight_count": 16074
  },
  {
    "carrier_name": "Comair",
    "avg_distance": 451.8911764705882,
    "flight_count": 4420
  },
  {
    "carrier_name": "American Eagle",
    "avg_distance": 267.90969815363286,
    "flight_count": 15869
  },
  {
    "carrier_name": "Atlantic Southeast",
    "avg_distance": 201.17800748303634,
    "flight_count": 15769
  }
]
SELECT 
   carriers_0."nickname" as "carrier_name",
   AVG(flights."distance") as "avg_distance",
   COUNT( 1) as "flight_count"
FROM '../../documentation/data/flights.parquet' as flights
 LEFT JOIN '../../documentation/data/carriers.parquet' AS carriers_0
  ON carriers_0."code"=flights."carrier"
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Changing the sort order

We can change the sort order by adding a {order_by: } clause

document
run: flights -> 
  carrier_name
  + {aggregate: avg_distance is distance.avg()}
  + flight_count 
  + {order_by: flight_count desc}
QUERY RESULTS
carrier_​nameavg_​distanceflight_​count
Southwest615.4288,751
USAir629.50537,683
American1,089.88334,577
Northwest993.9433,580
United1,187.01132,757
Delta670.64732,130
Continental Express477.58916,074
American Eagle267.9115,869
Atlantic Southeast201.17815,769
America West660.6889,750
Alaska836.6798,453
Continental811.6787,139
Jetblue1,332.5674,842
Comair451.8914,420
ATA872.1493,033
[
  {
    "carrier_name": "Southwest",
    "avg_distance": 615.4201304774031,
    "flight_count": 88751
  },
  {
    "carrier_name": "USAir",
    "avg_distance": 629.5051349414855,
    "flight_count": 37683
  },
  {
    "carrier_name": "American",
    "avg_distance": 1089.8830147207682,
    "flight_count": 34577
  },
  {
    "carrier_name": "Northwest",
    "avg_distance": 993.9399344848124,
    "flight_count": 33580
  },
  {
    "carrier_name": "United",
    "avg_distance": 1187.0114479347926,
    "flight_count": 32757
  },
  {
    "carrier_name": "Delta",
    "avg_distance": 670.6465608465609,
    "flight_count": 32130
  },
  {
    "carrier_name": "Continental Express",
    "avg_distance": 477.58902575587905,
    "flight_count": 16074
  },
  {
    "carrier_name": "American Eagle",
    "avg_distance": 267.90969815363286,
    "flight_count": 15869
  },
  {
    "carrier_name": "Atlantic Southeast",
    "avg_distance": 201.17800748303634,
    "flight_count": 15769
  },
  {
    "carrier_name": "America West",
    "avg_distance": 660.6878974358974,
    "flight_count": 9750
  },
  {
    "carrier_name": "Alaska",
    "avg_distance": 836.679403761978,
    "flight_count": 8453
  },
  {
    "carrier_name": "Continental",
    "avg_distance": 811.6783863286174,
    "flight_count": 7139
  },
  {
    "carrier_name": "Jetblue",
    "avg_distance": 1332.5667079719124,
    "flight_count": 4842
  },
  {
    "carrier_name": "Comair",
    "avg_distance": 451.8911764705882,
    "flight_count": 4420
  },
  {
    "carrier_name": "ATA",
    "avg_distance": 872.1486976590834,
    "flight_count": 3033
  }
]
SELECT 
   carriers_0."nickname" as "carrier_name",
   AVG(flights."distance") as "avg_distance",
   COUNT( 1) as "flight_count"
FROM '../../documentation/data/flights.parquet' as flights
 LEFT JOIN '../../documentation/data/carriers.parquet' AS carriers_0
  ON carriers_0."code"=flights."carrier"
GROUP BY 1
ORDER BY 3 desc NULLS LAST

Adding your own dimensions

You can group by an expression. The expressions can contain just about any calculation you can do in SQL.

document
run: flights -> 
  {group_by: carrier is concat(carrier, ' - ', carrier_name)}
  + origin_count
  + flight_count
  
QUERY RESULTS
carrierorigin_​countflight_​count
RU - Continental Express12616,074
OH - Comair1204,420
DL - Delta9732,130
AA - American8934,577
UA - United8932,757
NW - Northwest8833,580
US - USAir8237,683
CO - Continental787,139
MQ - American Eagle7715,869
WN - Southwest6388,751
EV - Atlantic Southeast5915,769
HP - America West419,750
B6 - Jetblue324,842
TZ - ATA253,033
AS - Alaska228,453
[
  {
    "carrier": "RU - Continental Express",
    "origin_count": 126,
    "flight_count": 16074
  },
  {
    "carrier": "OH - Comair",
    "origin_count": 120,
    "flight_count": 4420
  },
  {
    "carrier": "DL - Delta",
    "origin_count": 97,
    "flight_count": 32130
  },
  {
    "carrier": "AA - American",
    "origin_count": 89,
    "flight_count": 34577
  },
  {
    "carrier": "UA - United",
    "origin_count": 89,
    "flight_count": 32757
  },
  {
    "carrier": "NW - Northwest",
    "origin_count": 88,
    "flight_count": 33580
  },
  {
    "carrier": "US - USAir",
    "origin_count": 82,
    "flight_count": 37683
  },
  {
    "carrier": "CO - Continental",
    "origin_count": 78,
    "flight_count": 7139
  },
  {
    "carrier": "MQ - American Eagle",
    "origin_count": 77,
    "flight_count": 15869
  },
  {
    "carrier": "WN - Southwest",
    "origin_count": 63,
    "flight_count": 88751
  },
  {
    "carrier": "EV - Atlantic Southeast",
    "origin_count": 59,
    "flight_count": 15769
  },
  {
    "carrier": "HP - America West",
    "origin_count": 41,
    "flight_count": 9750
  },
  {
    "carrier": "B6 - Jetblue",
    "origin_count": 32,
    "flight_count": 4842
  },
  {
    "carrier": "TZ - ATA",
    "origin_count": 25,
    "flight_count": 3033
  },
  {
    "carrier": "AS - Alaska",
    "origin_count": 22,
    "flight_count": 8453
  }
]
SELECT 
   CONCAT(flights."carrier",' - ',(carriers_0."nickname")) as "carrier",
   COUNT(DISTINCT origin_0."code") as "origin_count",
   COUNT( 1) as "flight_count"
FROM '../../documentation/data/flights.parquet' as flights
 LEFT JOIN '../../documentation/data/carriers.parquet' AS carriers_0
  ON carriers_0."code"=flights."carrier"
 LEFT JOIN '../../documentation/data/airports.parquet' AS origin_0
  ON origin_0."code"=flights."origin"
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Working with Time

A big part of working with data is working with time. Queries that have time in the first column are sorted in descending order by time.

document
run: flights -> 
  {group_by: flight_month is dep_time.month}
  + flight_count
  + {where: carrier = 'WN'}
QUERY RESULTS
flight_​monthflight_​count
2005-121,606
2005-111,448
2005-101,543
2005-091,466
2005-081,582
2005-071,564
2005-061,383
2005-051,384
2005-041,432
2005-031,439
2005-021,281
2005-011,421
2004-121,408
2004-111,370
2004-101,421
2004-091,305
2004-081,154
2004-07990
2004-061,088
2004-051,225
2004-041,213
2004-031,197
2004-021,120
2004-011,149
2003-121,205
2003-111,137
2003-101,160
2003-091,199
2003-081,219
2003-071,252
2003-061,205
2003-051,232
2003-041,193
2003-031,191
2003-021,098
2003-011,209
2002-121,250
2002-111,179
2002-101,280
2002-091,214
2002-081,286
2002-071,235
2002-061,215
2002-051,291
2002-041,186
2002-031,240
2002-021,092
2002-011,240
2001-121,159
2001-111,224
2001-101,309
2001-091,150
2001-081,318
2001-071,299
2001-061,254
2001-051,216
2001-041,218
2001-03747
2001-021,212
2001-011,315
2000-121,116
2000-111,059
2000-101,108
2000-091,040
2000-081,143
2000-071,070
2000-061,030
2000-051,151
2000-041,097
2000-031,117
2000-021,088
2000-011,114
[
  {
    "flight_month": "2005-12-01T00:00:00.000Z",
    "flight_count": 1606
  },
  {
    "flight_month": "2005-11-01T00:00:00.000Z",
    "flight_count": 1448
  },
  {
    "flight_month": "2005-10-01T00:00:00.000Z",
    "flight_count": 1543
  },
  {
    "flight_month": "2005-09-01T00:00:00.000Z",
    "flight_count": 1466
  },
  {
    "flight_month": "2005-08-01T00:00:00.000Z",
    "flight_count": 1582
  },
  {
    "flight_month": "2005-07-01T00:00:00.000Z",
    "flight_count": 1564
  },
  {
    "flight_month": "2005-06-01T00:00:00.000Z",
    "flight_count": 1383
  },
  {
    "flight_month": "2005-05-01T00:00:00.000Z",
    "flight_count": 1384
  },
  {
    "flight_month": "2005-04-01T00:00:00.000Z",
    "flight_count": 1432
  },
  {
    "flight_month": "2005-03-01T00:00:00.000Z",
    "flight_count": 1439
  },
  {
    "flight_month": "2005-02-01T00:00:00.000Z",
    "flight_count": 1281
  },
  {
    "flight_month": "2005-01-01T00:00:00.000Z",
    "flight_count": 1421
  },
  {
    "flight_month": "2004-12-01T00:00:00.000Z",
    "flight_count": 1408
  },
  {
    "flight_month": "2004-11-01T00:00:00.000Z",
    "flight_count": 1370
  },
  {
    "flight_month": "2004-10-01T00:00:00.000Z",
    "flight_count": 1421
  },
  {
    "flight_month": "2004-09-01T00:00:00.000Z",
    "flight_count": 1305
  },
  {
    "flight_month": "2004-08-01T00:00:00.000Z",
    "flight_count": 1154
  },
  {
    "flight_month": "2004-07-01T00:00:00.000Z",
    "flight_count": 990
  },
  {
    "flight_month": "2004-06-01T00:00:00.000Z",
    "flight_count": 1088
  },
  {
    "flight_month": "2004-05-01T00:00:00.000Z",
    "flight_count": 1225
  },
  {
    "flight_month": "2004-04-01T00:00:00.000Z",
    "flight_count": 1213
  },
  {
    "flight_month": "2004-03-01T00:00:00.000Z",
    "flight_count": 1197
  },
  {
    "flight_month": "2004-02-01T00:00:00.000Z",
    "flight_count": 1120
  },
  {
    "flight_month": "2004-01-01T00:00:00.000Z",
    "flight_count": 1149
  },
  {
    "flight_month": "2003-12-01T00:00:00.000Z",
    "flight_count": 1205
  },
  {
    "flight_month": "2003-11-01T00:00:00.000Z",
    "flight_count": 1137
  },
  {
    "flight_month": "2003-10-01T00:00:00.000Z",
    "flight_count": 1160
  },
  {
    "flight_month": "2003-09-01T00:00:00.000Z",
    "flight_count": 1199
  },
  {
    "flight_month": "2003-08-01T00:00:00.000Z",
    "flight_count": 1219
  },
  {
    "flight_month": "2003-07-01T00:00:00.000Z",
    "flight_count": 1252
  },
  {
    "flight_month": "2003-06-01T00:00:00.000Z",
    "flight_count": 1205
  },
  {
    "flight_month": "2003-05-01T00:00:00.000Z",
    "flight_count": 1232
  },
  {
    "flight_month": "2003-04-01T00:00:00.000Z",
    "flight_count": 1193
  },
  {
    "flight_month": "2003-03-01T00:00:00.000Z",
    "flight_count": 1191
  },
  {
    "flight_month": "2003-02-01T00:00:00.000Z",
    "flight_count": 1098
  },
  {
    "flight_month": "2003-01-01T00:00:00.000Z",
    "flight_count": 1209
  },
  {
    "flight_month": "2002-12-01T00:00:00.000Z",
    "flight_count": 1250
  },
  {
    "flight_month": "2002-11-01T00:00:00.000Z",
    "flight_count": 1179
  },
  {
    "flight_month": "2002-10-01T00:00:00.000Z",
    "flight_count": 1280
  },
  {
    "flight_month": "2002-09-01T00:00:00.000Z",
    "flight_count": 1214
  },
  {
    "flight_month": "2002-08-01T00:00:00.000Z",
    "flight_count": 1286
  },
  {
    "flight_month": "2002-07-01T00:00:00.000Z",
    "flight_count": 1235
  },
  {
    "flight_month": "2002-06-01T00:00:00.000Z",
    "flight_count": 1215
  },
  {
    "flight_month": "2002-05-01T00:00:00.000Z",
    "flight_count": 1291
  },
  {
    "flight_month": "2002-04-01T00:00:00.000Z",
    "flight_count": 1186
  },
  {
    "flight_month": "2002-03-01T00:00:00.000Z",
    "flight_count": 1240
  },
  {
    "flight_month": "2002-02-01T00:00:00.000Z",
    "flight_count": 1092
  },
  {
    "flight_month": "2002-01-01T00:00:00.000Z",
    "flight_count": 1240
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 1159
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 1224
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 1309
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 1150
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 1318
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 1299
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 1254
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 1216
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 1218
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 747
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 1212
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 1315
  },
  {
    "flight_month": "2000-12-01T00:00:00.000Z",
    "flight_count": 1116
  },
  {
    "flight_month": "2000-11-01T00:00:00.000Z",
    "flight_count": 1059
  },
  {
    "flight_month": "2000-10-01T00:00:00.000Z",
    "flight_count": 1108
  },
  {
    "flight_month": "2000-09-01T00:00:00.000Z",
    "flight_count": 1040
  },
  {
    "flight_month": "2000-08-01T00:00:00.000Z",
    "flight_count": 1143
  },
  {
    "flight_month": "2000-07-01T00:00:00.000Z",
    "flight_count": 1070
  },
  {
    "flight_month": "2000-06-01T00:00:00.000Z",
    "flight_count": 1030
  },
  {
    "flight_month": "2000-05-01T00:00:00.000Z",
    "flight_count": 1151
  },
  {
    "flight_month": "2000-04-01T00:00:00.000Z",
    "flight_count": 1097
  },
  {
    "flight_month": "2000-03-01T00:00:00.000Z",
    "flight_count": 1117
  },
  {
    "flight_month": "2000-02-01T00:00:00.000Z",
    "flight_count": 1088
  },
  {
    "flight_month": "2000-01-01T00:00:00.000Z",
    "flight_count": 1114
  }
]
SELECT 
   DATE_TRUNC('month', flights."dep_time") as "flight_month",
   COUNT( 1) as "flight_count"
FROM '../../documentation/data/flights.parquet' as flights
WHERE flights."carrier"='WN'
GROUP BY 1
ORDER BY 1 desc NULLS LAST

Annotations and Charting

Charts are generally another view on tables. For example, the table above can be viewed as a line chart. The x-axis is flight_month and the y-axis is flight_count. Malloy's annotations let you tag a query so the rendering engine can show the results in different ways. We simply tag the query above as a # line_chart.

document
# line_chart
run: flights -> 
  {group_by: flight_month is dep_time.month}
  + flight_count
  + {where: carrier = 'WN'}
QUERY RESULTS
2000AprilJulyOctober2001AprilJulyOctober2002AprilJulyOctober2003AprilJulyOctober2004AprilJulyOctober2005AprilJulyOctoberflight_month7008009001,0001,1001,2001,3001,4001,5001,6001,700flight_count
[
  {
    "flight_month": "2005-12-01T00:00:00.000Z",
    "flight_count": 1606
  },
  {
    "flight_month": "2005-11-01T00:00:00.000Z",
    "flight_count": 1448
  },
  {
    "flight_month": "2005-10-01T00:00:00.000Z",
    "flight_count": 1543
  },
  {
    "flight_month": "2005-09-01T00:00:00.000Z",
    "flight_count": 1466
  },
  {
    "flight_month": "2005-08-01T00:00:00.000Z",
    "flight_count": 1582
  },
  {
    "flight_month": "2005-07-01T00:00:00.000Z",
    "flight_count": 1564
  },
  {
    "flight_month": "2005-06-01T00:00:00.000Z",
    "flight_count": 1383
  },
  {
    "flight_month": "2005-05-01T00:00:00.000Z",
    "flight_count": 1384
  },
  {
    "flight_month": "2005-04-01T00:00:00.000Z",
    "flight_count": 1432
  },
  {
    "flight_month": "2005-03-01T00:00:00.000Z",
    "flight_count": 1439
  },
  {
    "flight_month": "2005-02-01T00:00:00.000Z",
    "flight_count": 1281
  },
  {
    "flight_month": "2005-01-01T00:00:00.000Z",
    "flight_count": 1421
  },
  {
    "flight_month": "2004-12-01T00:00:00.000Z",
    "flight_count": 1408
  },
  {
    "flight_month": "2004-11-01T00:00:00.000Z",
    "flight_count": 1370
  },
  {
    "flight_month": "2004-10-01T00:00:00.000Z",
    "flight_count": 1421
  },
  {
    "flight_month": "2004-09-01T00:00:00.000Z",
    "flight_count": 1305
  },
  {
    "flight_month": "2004-08-01T00:00:00.000Z",
    "flight_count": 1154
  },
  {
    "flight_month": "2004-07-01T00:00:00.000Z",
    "flight_count": 990
  },
  {
    "flight_month": "2004-06-01T00:00:00.000Z",
    "flight_count": 1088
  },
  {
    "flight_month": "2004-05-01T00:00:00.000Z",
    "flight_count": 1225
  },
  {
    "flight_month": "2004-04-01T00:00:00.000Z",
    "flight_count": 1213
  },
  {
    "flight_month": "2004-03-01T00:00:00.000Z",
    "flight_count": 1197
  },
  {
    "flight_month": "2004-02-01T00:00:00.000Z",
    "flight_count": 1120
  },
  {
    "flight_month": "2004-01-01T00:00:00.000Z",
    "flight_count": 1149
  },
  {
    "flight_month": "2003-12-01T00:00:00.000Z",
    "flight_count": 1205
  },
  {
    "flight_month": "2003-11-01T00:00:00.000Z",
    "flight_count": 1137
  },
  {
    "flight_month": "2003-10-01T00:00:00.000Z",
    "flight_count": 1160
  },
  {
    "flight_month": "2003-09-01T00:00:00.000Z",
    "flight_count": 1199
  },
  {
    "flight_month": "2003-08-01T00:00:00.000Z",
    "flight_count": 1219
  },
  {
    "flight_month": "2003-07-01T00:00:00.000Z",
    "flight_count": 1252
  },
  {
    "flight_month": "2003-06-01T00:00:00.000Z",
    "flight_count": 1205
  },
  {
    "flight_month": "2003-05-01T00:00:00.000Z",
    "flight_count": 1232
  },
  {
    "flight_month": "2003-04-01T00:00:00.000Z",
    "flight_count": 1193
  },
  {
    "flight_month": "2003-03-01T00:00:00.000Z",
    "flight_count": 1191
  },
  {
    "flight_month": "2003-02-01T00:00:00.000Z",
    "flight_count": 1098
  },
  {
    "flight_month": "2003-01-01T00:00:00.000Z",
    "flight_count": 1209
  },
  {
    "flight_month": "2002-12-01T00:00:00.000Z",
    "flight_count": 1250
  },
  {
    "flight_month": "2002-11-01T00:00:00.000Z",
    "flight_count": 1179
  },
  {
    "flight_month": "2002-10-01T00:00:00.000Z",
    "flight_count": 1280
  },
  {
    "flight_month": "2002-09-01T00:00:00.000Z",
    "flight_count": 1214
  },
  {
    "flight_month": "2002-08-01T00:00:00.000Z",
    "flight_count": 1286
  },
  {
    "flight_month": "2002-07-01T00:00:00.000Z",
    "flight_count": 1235
  },
  {
    "flight_month": "2002-06-01T00:00:00.000Z",
    "flight_count": 1215
  },
  {
    "flight_month": "2002-05-01T00:00:00.000Z",
    "flight_count": 1291
  },
  {
    "flight_month": "2002-04-01T00:00:00.000Z",
    "flight_count": 1186
  },
  {
    "flight_month": "2002-03-01T00:00:00.000Z",
    "flight_count": 1240
  },
  {
    "flight_month": "2002-02-01T00:00:00.000Z",
    "flight_count": 1092
  },
  {
    "flight_month": "2002-01-01T00:00:00.000Z",
    "flight_count": 1240
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 1159
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 1224
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 1309
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 1150
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 1318
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 1299
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 1254
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 1216
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 1218
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 747
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 1212
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 1315
  },
  {
    "flight_month": "2000-12-01T00:00:00.000Z",
    "flight_count": 1116
  },
  {
    "flight_month": "2000-11-01T00:00:00.000Z",
    "flight_count": 1059
  },
  {
    "flight_month": "2000-10-01T00:00:00.000Z",
    "flight_count": 1108
  },
  {
    "flight_month": "2000-09-01T00:00:00.000Z",
    "flight_count": 1040
  },
  {
    "flight_month": "2000-08-01T00:00:00.000Z",
    "flight_count": 1143
  },
  {
    "flight_month": "2000-07-01T00:00:00.000Z",
    "flight_count": 1070
  },
  {
    "flight_month": "2000-06-01T00:00:00.000Z",
    "flight_count": 1030
  },
  {
    "flight_month": "2000-05-01T00:00:00.000Z",
    "flight_count": 1151
  },
  {
    "flight_month": "2000-04-01T00:00:00.000Z",
    "flight_count": 1097
  },
  {
    "flight_month": "2000-03-01T00:00:00.000Z",
    "flight_count": 1117
  },
  {
    "flight_month": "2000-02-01T00:00:00.000Z",
    "flight_count": 1088
  },
  {
    "flight_month": "2000-01-01T00:00:00.000Z",
    "flight_count": 1114
  }
]
SELECT 
   DATE_TRUNC('month', flights."dep_time") as "flight_month",
   COUNT( 1) as "flight_count"
FROM '../../documentation/data/flights.parquet' as flights
WHERE flights."carrier"='WN'
GROUP BY 1
ORDER BY 1 desc NULLS LAST

Filtering Time

Filtering time ranges is always difficult in SQL. Malloy time ranges can be specified simply. We add a filter to limit the time range to the year 2001.

document
# line_chart
run: flights -> 
  {group_by: flight_month is dep_time.month}
  + flight_count
  + carrier_name
  + {where: dep_time ? @2001}
QUERY RESULTS
2001FebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecemberflight_month02004006008001,0001,2001,400flight_countAlaskaAmerica WestAmericanAmerican EagleContinentalDeltaNorthwestSouthwestUSAirUnitedcarrier_name
[
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 418,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 1159,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 486,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 115,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 432,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 108,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 247,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 634,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 84,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-12-01T00:00:00.000Z",
    "flight_count": 403,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 1224,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 462,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 52,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 113,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 317,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 399,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 101,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 440,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 212,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-11-01T00:00:00.000Z",
    "flight_count": 499,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 346,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 110,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 456,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 290,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 1309,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 455,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 94,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 98,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 290,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-10-01T00:00:00.000Z",
    "flight_count": 361,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 227,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 449,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 450,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 76,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 296,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 1150,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 347,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 419,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 67,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-09-01T00:00:00.000Z",
    "flight_count": 135,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 363,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 1318,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 557,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 153,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 516,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 133,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 554,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 343,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 554,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-08-01T00:00:00.000Z",
    "flight_count": 116,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 498,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 123,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 367,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 583,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 1299,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 522,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 142,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 143,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 491,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-07-01T00:00:00.000Z",
    "flight_count": 272,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 338,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 1254,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 543,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 160,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 512,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 133,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 309,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 607,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 485,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-06-01T00:00:00.000Z",
    "flight_count": 110,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 312,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 1216,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 466,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 151,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 139,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 491,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 327,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 646,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 535,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-05-01T00:00:00.000Z",
    "flight_count": 124,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 641,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 305,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 553,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 112,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 277,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 1218,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 523,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 478,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 120,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-04-01T00:00:00.000Z",
    "flight_count": 101,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 318,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 514,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 747,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 150,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 478,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 127,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 589,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 332,
    "carrier_name": "American Eagle"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 589,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-03-01T00:00:00.000Z",
    "flight_count": 25,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 230,
    "carrier_name": "United"
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 1212,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 154,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 464,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 443,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 138,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 552,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 387,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-02-01T00:00:00.000Z",
    "flight_count": 92,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 437,
    "carrier_name": "Delta"
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 134,
    "carrier_name": "Continental"
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 656,
    "carrier_name": "USAir"
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 1315,
    "carrier_name": "Southwest"
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 533,
    "carrier_name": "American"
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 184,
    "carrier_name": "America West"
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 493,
    "carrier_name": "Northwest"
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 118,
    "carrier_name": "Alaska"
  },
  {
    "flight_month": "2001-01-01T00:00:00.000Z",
    "flight_count": 201,
    "carrier_name": "United"
  }
]
SELECT 
   DATE_TRUNC('month', flights."dep_time") as "flight_month",
   COUNT( 1) as "flight_count",
   carriers_0."nickname" as "carrier_name"
FROM '../../documentation/data/flights.parquet' as flights
 LEFT JOIN '../../documentation/data/carriers.parquet' AS carriers_0
  ON carriers_0."code"=flights."carrier"
WHERE (flights."dep_time">=TIMESTAMP '2001-01-01 00:00:00')and(flights."dep_time"<TIMESTAMP '2002-01-01 00:00:00')
GROUP BY 1,3
ORDER BY 1 desc NULLS LAST

Views: Pre-built Queries

Semantic models can include views. Views are pre-built queries. Often in a dataset there are several interesting ways of looking at the dataset. A common use for views is to declare these in advance.

document
run: flights -> by_carrier
QUERY RESULTS
carrierflight_​counttotal_​distancepercent_​of_​flights
WN - Southwest88,75154,619,15225.74%
US - USAir37,68323,721,64210.93%
AA - American34,57737,684,88510.03%
NW - Northwest33,58033,376,5039.74%
UA - United32,75738,882,9349.5%
DL - Delta32,13021,547,8749.32%
RU - Continental Express16,0747,676,7664.66%
MQ - American Eagle15,8694,251,4594.6%
EV - Atlantic Southeast15,7693,172,3764.57%
HP - America West9,7506,441,7072.83%
AS - Alaska8,4537,072,4512.45%
CO - Continental7,1395,794,5722.07%
B6 - Jetblue4,8426,452,2881.4%
OH - Comair4,4201,997,3591.28%
TZ - ATA3,0332,645,2270.88%
[
  {
    "carrier": "WN - Southwest",
    "flight_count": 88751,
    "total_distance": 54619152,
    "percent_of_flights": 0.2573783375431738
  },
  {
    "carrier": "US - USAir",
    "flight_count": 37683,
    "total_distance": 23721642,
    "percent_of_flights": 0.10928088577750582
  },
  {
    "carrier": "AA - American",
    "flight_count": 34577,
    "total_distance": 37684885,
    "percent_of_flights": 0.10027347046489979
  },
  {
    "carrier": "NW - Northwest",
    "flight_count": 33580,
    "total_distance": 33376503,
    "percent_of_flights": 0.09738216554968143
  },
  {
    "carrier": "UA - United",
    "flight_count": 32757,
    "total_distance": 38882934,
    "percent_of_flights": 0.09499546149228454
  },
  {
    "carrier": "DL - Delta",
    "flight_count": 32130,
    "total_distance": 21547874,
    "percent_of_flights": 0.09317715840116929
  },
  {
    "carrier": "RU - Continental Express",
    "flight_count": 16074,
    "total_distance": 7676766,
    "percent_of_flights": 0.046614679244954715
  },
  {
    "carrier": "MQ - American Eagle",
    "flight_count": 15869,
    "total_distance": 4251459,
    "percent_of_flights": 0.046020178234302996
  },
  {
    "carrier": "EV - Atlantic Southeast",
    "flight_count": 15769,
    "total_distance": 3172376,
    "percent_of_flights": 0.04573017774130216
  },
  {
    "carrier": "HP - America West",
    "flight_count": 9750,
    "total_distance": 6441707,
    "percent_of_flights": 0.028275048067581715
  },
  {
    "carrier": "AS - Alaska",
    "flight_count": 8453,
    "total_distance": 7072451,
    "percent_of_flights": 0.024513741673360845
  },
  {
    "carrier": "CO - Continental",
    "flight_count": 7139,
    "total_distance": 5794572,
    "percent_of_flights": 0.020703135195329833
  },
  {
    "carrier": "B6 - Jetblue",
    "flight_count": 4842,
    "total_distance": 6452288,
    "percent_of_flights": 0.01404182387110058
  },
  {
    "carrier": "OH - Comair",
    "flight_count": 4420,
    "total_distance": 1997359,
    "percent_of_flights": 0.012818021790637044
  },
  {
    "carrier": "TZ - ATA",
    "flight_count": 3033,
    "total_distance": 2645227,
    "percent_of_flights": 0.00879571495271542
  }
]
WITH __stage0 AS (
  SELECT
    group_set,
    CASE WHEN group_set=1 THEN
      CONCAT(flights."carrier",' - ',(carriers_0."nickname"))
      END as "carrier__1",
    CASE WHEN group_set=1 THEN
      COUNT( 1)
      END as "flight_count__1",
    CASE WHEN group_set=1 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__1",
    (CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=0 THEN
      COUNT( 1)
      END)) OVER () as "percent_of_flights__1"
  FROM '../../documentation/data/flights.parquet' as flights
   LEFT JOIN '../../documentation/data/carriers.parquet' AS carriers_0
    ON carriers_0."code"=flights."carrier"
  CROSS JOIN (SELECT UNNEST(GENERATE_SERIES(0,1,1)) as group_set  ) as group_set
  GROUP BY 1,2
)
SELECT
  "carrier__1" as "carrier",
  MAX(CASE WHEN group_set=1 THEN "flight_count__1" END) as "flight_count",
  MAX(CASE WHEN group_set=1 THEN "total_distance__1" END) as "total_distance",
  MAX(CASE WHEN group_set=1 THEN "percent_of_flights__1" END) as "percent_of_flights"
FROM __stage0
WHERE group_set NOT IN (0)
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Convention: the 'metrics' view.

Malloy models often contain a metrics view. The metrics view contains the most common ways of measuring data in this data set. This makes it easy build queries on the fly.

document
run: flights -> metrics
QUERY RESULTS
flight_​counttotal_​distancepercent_​of_​flights
344,827255,337,195100%
[
  {
    "flight_count": 344827,
    "total_distance": 255337195,
    "percent_of_flights": 1
  }
]
WITH __stage0 AS (
  SELECT
    group_set,
    CASE WHEN group_set=1 THEN
      COUNT( 1)
      END as "flight_count__1",
    CASE WHEN group_set=1 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__1",
    (CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=0 THEN
      COUNT( 1)
      END)) OVER () as "percent_of_flights__1"
  FROM '../../documentation/data/flights.parquet' as flights
  CROSS JOIN (SELECT UNNEST(GENERATE_SERIES(0,1,1)) as group_set  ) as group_set
  GROUP BY 1
)
SELECT
  MAX(CASE WHEN group_set=1 THEN "flight_count__1" END) as "flight_count",
  MAX(CASE WHEN group_set=1 THEN "total_distance__1" END) as "total_distance",
  MAX(CASE WHEN group_set=1 THEN "percent_of_flights__1" END) as "percent_of_flights"
FROM __stage0
WHERE group_set NOT IN (0)

Metrics by Origin

Views can be combined in queries just like all the other parts.

document
run: flights -> origin_name + metrics
QUERY RESULTS
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
ATL - ATLANTA17,8758,722,0805.18%
DFW - DALLAS-FORT WORTH17,78212,292,4625.16%
ORD - CHICAGO14,21414,040,1864.12%
PHX - PHOENIX12,47610,310,5113.62%
LAS - LAS VEGAS11,0968,782,0933.22%
LAX - LOS ANGELES11,07712,861,8473.21%
MSP - MINNEAPOLIS9,7629,798,8572.83%
DTW - DETROIT8,1616,639,4492.37%
PHL - PHILADELPHIA7,7085,685,1112.24%
LGA - NEW YORK7,6233,991,9462.21%
DEN - DENVER7,1907,328,7632.09%
BWI - BALTIMORE7,1774,832,2422.08%
CLT - CHARLOTTE7,0994,010,3132.06%
SEA - SEATTLE7,0107,823,8352.03%
MCO - ORLANDO6,7906,330,4741.97%
DCA - WASHINGTON6,6783,093,5051.94%
IAH - HOUSTON6,6235,031,3221.92%
MDW - CHICAGO6,6114,795,3911.92%
BOS - BOSTON5,7974,481,5941.68%
EWR - NEWARK5,1743,930,7571.5%
CLE - CLEVELAND5,1272,430,6471.49%
OAK - OAKLAND5,0763,472,2371.47%
SAN - SAN DIEGO5,0754,691,3411.47%
TPA - TAMPA4,8683,912,2171.41%
PIT - PITTSBURGH4,5413,088,3051.32%
SFO - SAN FRANCISCO4,5406,391,7621.32%
BNA - NASHVILLE4,2873,192,9171.24%
STL - ST LOUIS4,0892,600,8891.19%
MCI - KANSAS CITY4,0783,259,5081.18%
IAD - WASHINGTON3,8855,360,9961.13%
SJC - SAN JOSE3,8252,826,6461.11%
JFK - NEW YORK3,6894,995,0321.07%
FLL - FORT LAUDERDALE3,6193,060,8111.05%
PDX - PORTLAND3,5963,486,9531.04%
SMF - SACRAMENTO3,5762,367,3761.04%
HOU - HOUSTON3,4301,910,6610.99%
CVG - COVINGTON/CINCINNATI, OH3,3001,881,1710.96%
MSY - NEW ORLEANS3,2542,384,2860.94%
ABQ - ALBUQUERQUE2,7621,842,5190.8%
SLC - SALT LAKE CITY2,7412,341,7680.79%
ONT - ONTARIO2,6421,492,5080.77%
RDU - RALEIGH/DURHAM2,4441,344,2680.71%
MIA - MIAMI2,3872,711,2980.69%
PVD - PROVIDENCE2,3611,657,4470.68%
MEM - MEMPHIS2,2421,929,1910.65%
IND - INDIANAPOLIS2,2261,476,0020.65%
BDL - WINDSOR LOCKS2,1681,549,1660.63%
AUS - AUSTIN2,0911,377,5920.61%
RNO - RENO1,9921,024,7200.58%
BUR - BURBANK1,952876,4790.57%
SNA - SANTA ANA1,9191,377,1100.56%
SAT - SAN ANTONIO1,8651,190,2710.54%
CMH - COLUMBUS1,712961,5550.5%
DAL - DALLAS1,662532,4630.48%
MHT - MANCHESTER1,6261,019,3660.47%
JAX - JACKSONVILLE1,599850,9620.46%
ELP - EL PASO1,438752,7190.42%
PBI - WEST PALM BEACH1,3791,193,3110.4%
ISP - ISLIP1,302839,5480.38%
BUF - BUFFALO1,246613,8730.36%
BHM - BIRMINGHAM1,200640,5070.35%
RSW - FORT MYERS1,1691,064,9410.34%
MKE - MILWAUKEE1,132646,5070.33%
ALB - ALBANY1,108584,5030.32%
TUS - TUCSON1,062671,3250.31%
SDF - LOUISVILLE1,003526,9470.29%
TUL - TULSA984427,5760.29%
OMA - OMAHA946630,5280.27%
RIC - RICHMOND946378,0390.27%
GEG - SPOKANE922426,9900.27%
OKC - OKLAHOMA CITY905406,9680.26%
ORF - NORFOLK888447,5310.26%
LIT - LITTLE ROCK853382,6250.25%
BOI - BOISE795424,1680.23%
PFN - PANAMA CITY778192,5740.23%
AGS - AUGUSTA756130,2840.22%
ANC - ANCHORAGE7481,303,8170.22%
ROC - ROCHESTER733250,8330.21%
AVL - ASHEVILLE727131,6330.21%
CHA - CHATTANOOGA69778,5260.2%
LGB - LONG BEACH661931,9140.19%
CSG - COLUMBUS65454,2820.19%
SJU - SAN JUAN6451,115,5610.19%
MYR - MYRTLE BEACH628167,9340.18%
HSV - HUNTSVILLE607132,3720.18%
SYR - SYRACUSE597214,1010.17%
MDT - HARRISBURG584190,6370.17%
TRI - BRISTOL/JOHNSON/KINGSPORT566127,9600.16%
GRR - GRAND RAPIDS513139,7760.15%
ABE - ALLENTOWN510207,8410.15%
MGM - MONTGOMERY50073,5000.15%
ACT - WACO49443,9660.14%
TYR - TYLER48049,4400.14%
GSO - GREENSBORO470174,4140.14%
GNV - GAINESVILLE470140,9220.14%
CHS - CHARLESTON466172,4850.14%
TYS - KNOXVILLE464128,2270.13%
SPS - WICHITA FALLS45751,6410.13%
CLL - COLLEGE STATION45473,9160.13%
COS - COLORADO SPRINGS426308,8350.12%
LBB - LUBBOCK425153,2380.12%
LAW - LAWTON42359,2200.12%
SAV - SAVANNAH419150,9110.12%
ILE - KILLEEN41654,1090.12%
DAY - DAYTON416153,0360.12%
MAF - MIDLAND409149,1760.12%
SHV - SHREVEPORT40681,7760.12%
VPS - VALPARAISO403110,6720.12%
CAE - COLUMBIA376111,5480.11%
JAN - JACKSON356189,4410.1%
PWM - PORTLAND326124,1180.09%
DHN - DOTHAN32455,4040.09%
XNA - FAYETTEVILLE/SPRINGDALE/319154,8480.09%
HPN - WHITE PLAINS315141,2520.09%
BTV - BURLINGTON307116,2190.09%
LEX - LEXINGTON305109,5150.09%
AMA - AMARILLO298115,1390.09%
ABI - ABILENE29747,0750.09%
TLH - TALLAHASSEE28572,7730.08%
GPT - GULFPORT27898,7680.08%
BTR - BATON ROUGE274102,1730.08%
MSN - MADISON27197,7920.08%
HNL - HONOLULU267763,8610.08%
GGG - LONGVIEW25836,1200.07%
DSM - DES MOINES254141,2380.07%
GSP - GREER241105,8380.07%
PSP - PALM SPRINGS240290,3000.07%
SJT - SAN ANGELO22350,9370.06%
TXK - TEXARKANA20737,4670.06%
FSM - FORT SMITH20245,8540.06%
VLD - VALDOSTA20041,6000.06%
PNS - PENSACOLA19490,1060.06%
SRQ - SARASOTA/BRADENTON192152,3060.06%
SGF - SPRINGFIELD18569,2450.05%
HRL - HARLINGEN18551,3550.05%
ICT - WICHITA18384,2960.05%
CRP - CORPUS CHRISTI18142,8940.05%
LFT - LAFAYETTE17647,8480.05%
GRK - FORT HOOD/KILLEEN16121,8300.05%
ROA - ROANOKE15849,7440.05%
MFE - MC ALLEN15458,8480.04%
ILM - WILMINGTON12825,2700.04%
MOB - MOBILE12542,0860.04%
FAI - FAIRBANKS11481,1440.03%
OGG - KAHULUI110236,1050.03%
LRD - LAREDO10740,1850.03%
MCN - MACON1028,0580.03%
BRO - BROWNSVILLE9428,9520.03%
BGR - BANGOR9425,0440.03%
JAC - JACKSON8642,3980.02%
FAR - FARGO8318,5090.02%
FAY - FAYETTEVILLE8327,4730.02%
FNT - FLINT8325,3840.02%
AEX - ALEXANDRIA8018,9300.02%
BPT - BEAUMONT/PORT ARTHUR7713,9140.02%
STT - CHARLOTTE AMALIE7638,3990.02%
PIE - ST PETERSBURG-CLEARWATER6577,3310.02%
BZN - BOZEMAN6254,7150.02%
FAT - FRESNO5774,8410.02%
AVP - WILKES-BARRE/SCRANTON5116,2000.01%
GRB - GREEN BAY4715,1200.01%
EVV - EVANSVILLE428,4000.01%
MSO - MISSOULA4141,5330.01%
LCH - LAKE CHARLES415,2070.01%
LAN - LANSING407,0080.01%
TOL - TOLEDO408,4040.01%
CID - CEDAR RAPIDS4015,3200.01%
DLH - DULUTH405,7600.01%
GTR - COLUMBUS/W POINT/STARKVILL379,4780.01%
MEI - MERIDIAN379,4630.01%
FSD - SIOUX FALLS3512,3390.01%
CRW - CHARLESTON3210,0550.01%
MTJ - MONTROSE3226,8530.01%
CAK - AKRON328,4440.01%
FWA - FORT WAYNE315,3320.01%
DAB - DAYTONA BEACH3126,0350.01%
SBN - SOUTH BEND256,0130.01%
KOA - KAILUA/KONA2464,1440.01%
EGE - EAGLE2413,3630.01%
ATW - APPLETON2411,6340.01%
RAP - RAPID CITY2210,7800.01%
ERI - ERIE214,3590.01%
EFD - HOUSTON215880.01%
AZO - KALAMAZOO194,2750.01%
ACY - ATLANTIC CITY189,7560.01%
SBA - SANTA BARBARA1822,9700.01%
GTF - GREAT FALLS1810,7790.01%
MLI - MOLINE175,9500%
FCA - KALISPELL1711,2820%
BIL - BILLINGS159,2170%
MLU - MONROE154,2400%
ACK - NANTUCKET153,2700%
- 145,3620%
LYH - LYNCHBURG145,1000%
SWF - NEWBURGH137,5790%
BGM - BINGHAMTON136,0680%
ORH - WORCESTER121,8000%
HDN - HAYDEN129,9240%
MLB - MELBOURNE107,4480%
BFL - BAKERSFIELD912,8520%
CHO - CHARLOTTESVILLE93,0780%
BQN - AGUADILLA914,1840%
LNK - LINCOLN94,1080%
CMI - CHAMPAIGN/URBANA81,6400%
GUC - GUNNISON71,5900%
ABY - ALBANY68760%
DRO - DURANGO53,5650%
HLN - HELENA52,0100%
BIS - BISMARCK51,9300%
EUG - EUGENE52,2550%
HTS - HUNTINGTON47110%
HVN - NEW HAVEN42,5680%
VCT - VICTORIA33690%
MRY - MONTEREY32310%
STX - CHRISTIANSTED34,6860%
EYW - KEY WEST34350%
PSE - PONCE34,8510%
BQK - BRUNSWICK24760%
TVC - TRAVERSE CITY26030%
FLO - FLORENCE12730%
PHF - NEWPORT NEWS14650%
ITH - ITHACA1320%
MFR - MEDFORD13290%
LSE - LA CROSSE12150%
ELM - ELMIRA/CORNING12080%
[
  {
    "origin_name": "ATL - ATLANTA",
    "flight_count": 17875,
    "total_distance": 8722080,
    "percent_of_flights": 0.05183758812389981
  },
  {
    "origin_name": "DFW - DALLAS-FORT WORTH",
    "flight_count": 17782,
    "total_distance": 12292462,
    "percent_of_flights": 0.05156788766540903
  },
  {
    "origin_name": "ORD - CHICAGO",
    "flight_count": 14214,
    "total_distance": 14040186,
    "percent_of_flights": 0.041220670075139125
  },
  {
    "origin_name": "PHX - PHOENIX",
    "flight_count": 12476,
    "total_distance": 10310511,
    "percent_of_flights": 0.03618046150678456
  },
  {
    "origin_name": "LAS - LAS VEGAS",
    "flight_count": 11096,
    "total_distance": 8782093,
    "percent_of_flights": 0.032178454703372994
  },
  {
    "origin_name": "LAX - LOS ANGELES",
    "flight_count": 11077,
    "total_distance": 12861847,
    "percent_of_flights": 0.03212335460970284
  },
  {
    "origin_name": "MSP - MINNEAPOLIS",
    "flight_count": 9762,
    "total_distance": 9798857,
    "percent_of_flights": 0.028309848126741817
  },
  {
    "origin_name": "DTW - DETROIT",
    "flight_count": 8161,
    "total_distance": 6639449,
    "percent_of_flights": 0.023666940233798398
  },
  {
    "origin_name": "PHL - PHILADELPHIA",
    "flight_count": 7708,
    "total_distance": 5685111,
    "percent_of_flights": 0.0223532380005046
  },
  {
    "origin_name": "LGA - NEW YORK",
    "flight_count": 7623,
    "total_distance": 3991946,
    "percent_of_flights": 0.02210673758145389
  },
  {
    "origin_name": "DEN - DENVER",
    "flight_count": 7190,
    "total_distance": 7328763,
    "percent_of_flights": 0.02085103544676026
  },
  {
    "origin_name": "BWI - BALTIMORE",
    "flight_count": 7177,
    "total_distance": 4832242,
    "percent_of_flights": 0.02081333538267015
  },
  {
    "origin_name": "CLT - CHARLOTTE",
    "flight_count": 7099,
    "total_distance": 4010313,
    "percent_of_flights": 0.020587134998129496
  },
  {
    "origin_name": "SEA - SEATTLE",
    "flight_count": 7010,
    "total_distance": 7823835,
    "percent_of_flights": 0.02032903455935875
  },
  {
    "origin_name": "MCO - ORLANDO",
    "flight_count": 6790,
    "total_distance": 6330474,
    "percent_of_flights": 0.019691033474756908
  },
  {
    "origin_name": "DCA - WASHINGTON",
    "flight_count": 6678,
    "total_distance": 3093505,
    "percent_of_flights": 0.01936623292259597
  },
  {
    "origin_name": "IAH - HOUSTON",
    "flight_count": 6623,
    "total_distance": 5031322,
    "percent_of_flights": 0.019206732651445506
  },
  {
    "origin_name": "MDW - CHICAGO",
    "flight_count": 6611,
    "total_distance": 4795391,
    "percent_of_flights": 0.019171932592285407
  },
  {
    "origin_name": "BOS - BOSTON",
    "flight_count": 5797,
    "total_distance": 4481594,
    "percent_of_flights": 0.016811328579258586
  },
  {
    "origin_name": "EWR - NEWARK",
    "flight_count": 5174,
    "total_distance": 3930757,
    "percent_of_flights": 0.015004625507863363
  },
  {
    "origin_name": "CLE - CLEVELAND",
    "flight_count": 5127,
    "total_distance": 2430647,
    "percent_of_flights": 0.01486832527615297
  },
  {
    "origin_name": "OAK - OAKLAND",
    "flight_count": 5076,
    "total_distance": 3472237,
    "percent_of_flights": 0.014720425024722542
  },
  {
    "origin_name": "SAN - SAN DIEGO",
    "flight_count": 5075,
    "total_distance": 4691341,
    "percent_of_flights": 0.014717525019792534
  },
  {
    "origin_name": "TPA - TAMPA",
    "flight_count": 4868,
    "total_distance": 3912217,
    "percent_of_flights": 0.014117223999280799
  },
  {
    "origin_name": "PIT - PITTSBURGH",
    "flight_count": 4541,
    "total_distance": 3088305,
    "percent_of_flights": 0.013168922387168058
  },
  {
    "origin_name": "SFO - SAN FRANCISCO",
    "flight_count": 4540,
    "total_distance": 6391762,
    "percent_of_flights": 0.01316602238223805
  },
  {
    "origin_name": "BNA - NASHVILLE",
    "flight_count": 4287,
    "total_distance": 3192917,
    "percent_of_flights": 0.012432321134945929
  },
  {
    "origin_name": "STL - ST LOUIS",
    "flight_count": 4089,
    "total_distance": 2600889,
    "percent_of_flights": 0.01185812015880427
  },
  {
    "origin_name": "MCI - KANSAS CITY",
    "flight_count": 4078,
    "total_distance": 3259508,
    "percent_of_flights": 0.011826220104574178
  },
  {
    "origin_name": "IAD - WASHINGTON",
    "flight_count": 3885,
    "total_distance": 5360996,
    "percent_of_flights": 0.01126651915308256
  },
  {
    "origin_name": "SJC - SAN JOSE",
    "flight_count": 3825,
    "total_distance": 2826646,
    "percent_of_flights": 0.011092518857282057
  },
  {
    "origin_name": "JFK - NEW YORK",
    "flight_count": 3689,
    "total_distance": 4995032,
    "percent_of_flights": 0.010698118186800918
  },
  {
    "origin_name": "FLL - FORT LAUDERDALE",
    "flight_count": 3619,
    "total_distance": 3060811,
    "percent_of_flights": 0.010495117841700331
  },
  {
    "origin_name": "PDX - PORTLAND",
    "flight_count": 3596,
    "total_distance": 3486953,
    "percent_of_flights": 0.010428417728310138
  },
  {
    "origin_name": "SMF - SACRAMENTO",
    "flight_count": 3576,
    "total_distance": 2367376,
    "percent_of_flights": 0.01037041762970997
  },
  {
    "origin_name": "HOU - HOUSTON",
    "flight_count": 3430,
    "total_distance": 1910661,
    "percent_of_flights": 0.009947016909928746
  },
  {
    "origin_name": "CVG - COVINGTON/CINCINNATI, OH",
    "flight_count": 3300,
    "total_distance": 1881171,
    "percent_of_flights": 0.009570016269027657
  },
  {
    "origin_name": "MSY - NEW ORLEANS",
    "flight_count": 3254,
    "total_distance": 2384286,
    "percent_of_flights": 0.009436616042247272
  },
  {
    "origin_name": "ABQ - ALBUQUERQUE",
    "flight_count": 2762,
    "total_distance": 1842519,
    "percent_of_flights": 0.008009813616683148
  },
  {
    "origin_name": "SLC - SALT LAKE CITY",
    "flight_count": 2741,
    "total_distance": 2341768,
    "percent_of_flights": 0.007948913513152972
  },
  {
    "origin_name": "ONT - ONTARIO",
    "flight_count": 2642,
    "total_distance": 1492508,
    "percent_of_flights": 0.007661813025082143
  },
  {
    "origin_name": "RDU - RALEIGH/DURHAM",
    "flight_count": 2444,
    "total_distance": 1344268,
    "percent_of_flights": 0.007087612048940483
  },
  {
    "origin_name": "MIA - MIAMI",
    "flight_count": 2387,
    "total_distance": 2711298,
    "percent_of_flights": 0.006922311767930006
  },
  {
    "origin_name": "PVD - PROVIDENCE",
    "flight_count": 2361,
    "total_distance": 1657447,
    "percent_of_flights": 0.006846911639749788
  },
  {
    "origin_name": "MEM - MEMPHIS",
    "flight_count": 2242,
    "total_distance": 1929191,
    "percent_of_flights": 0.00650181105307879
  },
  {
    "origin_name": "IND - INDIANAPOLIS",
    "flight_count": 2226,
    "total_distance": 1476002,
    "percent_of_flights": 0.006455410974198656
  },
  {
    "origin_name": "BDL - WINDSOR LOCKS",
    "flight_count": 2168,
    "total_distance": 1549166,
    "percent_of_flights": 0.00628721068825817
  },
  {
    "origin_name": "AUS - AUSTIN",
    "flight_count": 2091,
    "total_distance": 1377592,
    "percent_of_flights": 0.006063910308647525
  },
  {
    "origin_name": "RNO - RENO",
    "flight_count": 1992,
    "total_distance": 1024720,
    "percent_of_flights": 0.005776809820576695
  },
  {
    "origin_name": "BUR - BURBANK",
    "flight_count": 1952,
    "total_distance": 876479,
    "percent_of_flights": 0.005660809623376359
  },
  {
    "origin_name": "SNA - SANTA ANA",
    "flight_count": 1919,
    "total_distance": 1377110,
    "percent_of_flights": 0.005565109460686083
  },
  {
    "origin_name": "SAT - SAN ANTONIO",
    "flight_count": 1865,
    "total_distance": 1190271,
    "percent_of_flights": 0.005408509194465631
  },
  {
    "origin_name": "CMH - COLUMBUS",
    "flight_count": 1712,
    "total_distance": 961555,
    "percent_of_flights": 0.004964808440174349
  },
  {
    "origin_name": "DAL - DALLAS",
    "flight_count": 1662,
    "total_distance": 532463,
    "percent_of_flights": 0.004819808193673929
  },
  {
    "origin_name": "MHT - MANCHESTER",
    "flight_count": 1626,
    "total_distance": 1019366,
    "percent_of_flights": 0.004715408016193628
  },
  {
    "origin_name": "JAX - JACKSONVILLE",
    "flight_count": 1599,
    "total_distance": 850962,
    "percent_of_flights": 0.004637107883083401
  },
  {
    "origin_name": "ELP - EL PASO",
    "flight_count": 1438,
    "total_distance": 752719,
    "percent_of_flights": 0.004170207089352052
  },
  {
    "origin_name": "PBI - WEST PALM BEACH",
    "flight_count": 1379,
    "total_distance": 1193311,
    "percent_of_flights": 0.0039991067984815575
  },
  {
    "origin_name": "ISP - ISLIP",
    "flight_count": 1302,
    "total_distance": 839548,
    "percent_of_flights": 0.003775806418870912
  },
  {
    "origin_name": "BUF - BUFFALO",
    "flight_count": 1246,
    "total_distance": 613873,
    "percent_of_flights": 0.0036134061427904427
  },
  {
    "origin_name": "BHM - BIRMINGHAM",
    "flight_count": 1200,
    "total_distance": 640507,
    "percent_of_flights": 0.0034800059160100573
  },
  {
    "origin_name": "RSW - FORT MYERS",
    "flight_count": 1169,
    "total_distance": 1064941,
    "percent_of_flights": 0.0033901057631797976
  },
  {
    "origin_name": "MKE - MILWAUKEE",
    "flight_count": 1132,
    "total_distance": 646507,
    "percent_of_flights": 0.0032828055807694874
  },
  {
    "origin_name": "ALB - ALBANY",
    "flight_count": 1108,
    "total_distance": 584503,
    "percent_of_flights": 0.003213205462449286
  },
  {
    "origin_name": "TUS - TUCSON",
    "flight_count": 1062,
    "total_distance": 671325,
    "percent_of_flights": 0.0030798052356689008
  },
  {
    "origin_name": "SDF - LOUISVILLE",
    "flight_count": 1003,
    "total_distance": 526947,
    "percent_of_flights": 0.002908704944798406
  },
  {
    "origin_name": "TUL - TULSA",
    "flight_count": 984,
    "total_distance": 427576,
    "percent_of_flights": 0.002853604851128247
  },
  {
    "origin_name": "OMA - OMAHA",
    "flight_count": 946,
    "total_distance": 630528,
    "percent_of_flights": 0.0027434046637879283
  },
  {
    "origin_name": "RIC - RICHMOND",
    "flight_count": 946,
    "total_distance": 378039,
    "percent_of_flights": 0.0027434046637879283
  },
  {
    "origin_name": "GEG - SPOKANE",
    "flight_count": 922,
    "total_distance": 426990,
    "percent_of_flights": 0.002673804545467727
  },
  {
    "origin_name": "OKC - OKLAHOMA CITY",
    "flight_count": 905,
    "total_distance": 406968,
    "percent_of_flights": 0.0026245044616575847
  },
  {
    "origin_name": "ORF - NORFOLK",
    "flight_count": 888,
    "total_distance": 447531,
    "percent_of_flights": 0.0025752043778474423
  },
  {
    "origin_name": "LIT - LITTLE ROCK",
    "flight_count": 853,
    "total_distance": 382625,
    "percent_of_flights": 0.002473704205297149
  },
  {
    "origin_name": "BOI - BOISE",
    "flight_count": 795,
    "total_distance": 424168,
    "percent_of_flights": 0.002305503919356663
  },
  {
    "origin_name": "PFN - PANAMA CITY",
    "flight_count": 778,
    "total_distance": 192574,
    "percent_of_flights": 0.0022562038355465205
  },
  {
    "origin_name": "AGS - AUGUSTA",
    "flight_count": 756,
    "total_distance": 130284,
    "percent_of_flights": 0.002192403727086336
  },
  {
    "origin_name": "ANC - ANCHORAGE",
    "flight_count": 748,
    "total_distance": 1303817,
    "percent_of_flights": 0.002169203687646269
  },
  {
    "origin_name": "ROC - ROCHESTER",
    "flight_count": 733,
    "total_distance": 250833,
    "percent_of_flights": 0.0021257036136961434
  },
  {
    "origin_name": "AVL - ASHEVILLE",
    "flight_count": 727,
    "total_distance": 131633,
    "percent_of_flights": 0.002108303584116093
  },
  {
    "origin_name": "CHA - CHATTANOOGA",
    "flight_count": 697,
    "total_distance": 78526,
    "percent_of_flights": 0.0020213034362158416
  },
  {
    "origin_name": "LGB - LONG BEACH",
    "flight_count": 661,
    "total_distance": 931914,
    "percent_of_flights": 0.00191690325873554
  },
  {
    "origin_name": "CSG - COLUMBUS",
    "flight_count": 654,
    "total_distance": 54282,
    "percent_of_flights": 0.0018966032242254812
  },
  {
    "origin_name": "SJU - SAN JUAN",
    "flight_count": 645,
    "total_distance": 1115561,
    "percent_of_flights": 0.0018705031798554057
  },
  {
    "origin_name": "MYR - MYRTLE BEACH",
    "flight_count": 628,
    "total_distance": 167934,
    "percent_of_flights": 0.0018212030960452633
  },
  {
    "origin_name": "HSV - HUNTSVILLE",
    "flight_count": 607,
    "total_distance": 132372,
    "percent_of_flights": 0.0017603029925150873
  },
  {
    "origin_name": "SYR - SYRACUSE",
    "flight_count": 597,
    "total_distance": 214101,
    "percent_of_flights": 0.0017313029432150034
  },
  {
    "origin_name": "MDT - HARRISBURG",
    "flight_count": 584,
    "total_distance": 190637,
    "percent_of_flights": 0.0016936028791248944
  },
  {
    "origin_name": "TRI - BRISTOL/JOHNSON/KINGSPORT",
    "flight_count": 566,
    "total_distance": 127960,
    "percent_of_flights": 0.0016414027903847437
  },
  {
    "origin_name": "GRR - GRAND RAPIDS",
    "flight_count": 513,
    "total_distance": 139776,
    "percent_of_flights": 0.0014877025290942994
  },
  {
    "origin_name": "ABE - ALLENTOWN",
    "flight_count": 510,
    "total_distance": 207841,
    "percent_of_flights": 0.0014790025143042744
  },
  {
    "origin_name": "MGM - MONTGOMERY",
    "flight_count": 500,
    "total_distance": 73500,
    "percent_of_flights": 0.0014500024650041905
  },
  {
    "origin_name": "ACT - WACO",
    "flight_count": 494,
    "total_distance": 43966,
    "percent_of_flights": 0.0014326024354241402
  },
  {
    "origin_name": "TYR - TYLER",
    "flight_count": 480,
    "total_distance": 49440,
    "percent_of_flights": 0.0013920023664040228
  },
  {
    "origin_name": "GSO - GREENSBORO",
    "flight_count": 470,
    "total_distance": 174414,
    "percent_of_flights": 0.0013630023171039391
  },
  {
    "origin_name": "GNV - GAINESVILLE",
    "flight_count": 470,
    "total_distance": 140922,
    "percent_of_flights": 0.0013630023171039391
  },
  {
    "origin_name": "CHS - CHARLESTON",
    "flight_count": 466,
    "total_distance": 172485,
    "percent_of_flights": 0.0013514022973839055
  },
  {
    "origin_name": "TYS - KNOXVILLE",
    "flight_count": 464,
    "total_distance": 128227,
    "percent_of_flights": 0.0013456022875238888
  },
  {
    "origin_name": "SPS - WICHITA FALLS",
    "flight_count": 457,
    "total_distance": 51641,
    "percent_of_flights": 0.0013253022530138301
  },
  {
    "origin_name": "CLL - COLLEGE STATION",
    "flight_count": 454,
    "total_distance": 73916,
    "percent_of_flights": 0.0013166022382238049
  },
  {
    "origin_name": "COS - COLORADO SPRINGS",
    "flight_count": 426,
    "total_distance": 308835,
    "percent_of_flights": 0.0012354021001835702
  },
  {
    "origin_name": "LBB - LUBBOCK",
    "flight_count": 425,
    "total_distance": 153238,
    "percent_of_flights": 0.0012325020952535619
  },
  {
    "origin_name": "LAW - LAWTON",
    "flight_count": 423,
    "total_distance": 59220,
    "percent_of_flights": 0.0012267020853935452
  },
  {
    "origin_name": "SAV - SAVANNAH",
    "flight_count": 419,
    "total_distance": 150911,
    "percent_of_flights": 0.0012151020656735116
  },
  {
    "origin_name": "ILE - KILLEEN",
    "flight_count": 416,
    "total_distance": 54109,
    "percent_of_flights": 0.0012064020508834865
  },
  {
    "origin_name": "DAY - DAYTON",
    "flight_count": 416,
    "total_distance": 153036,
    "percent_of_flights": 0.0012064020508834865
  },
  {
    "origin_name": "MAF - MIDLAND",
    "flight_count": 409,
    "total_distance": 149176,
    "percent_of_flights": 0.0011861020163734279
  },
  {
    "origin_name": "SHV - SHREVEPORT",
    "flight_count": 406,
    "total_distance": 81776,
    "percent_of_flights": 0.0011774020015834026
  },
  {
    "origin_name": "VPS - VALPARAISO",
    "flight_count": 403,
    "total_distance": 110672,
    "percent_of_flights": 0.0011687019867933776
  },
  {
    "origin_name": "CAE - COLUMBIA",
    "flight_count": 376,
    "total_distance": 111548,
    "percent_of_flights": 0.0010904018536831513
  },
  {
    "origin_name": "JAN - JACKSON",
    "flight_count": 356,
    "total_distance": 189441,
    "percent_of_flights": 0.0010324017550829836
  },
  {
    "origin_name": "PWM - PORTLAND",
    "flight_count": 326,
    "total_distance": 124118,
    "percent_of_flights": 0.0009454016071827322
  },
  {
    "origin_name": "DHN - DOTHAN",
    "flight_count": 324,
    "total_distance": 55404,
    "percent_of_flights": 0.0009396015973227155
  },
  {
    "origin_name": "XNA - FAYETTEVILLE/SPRINGDALE/",
    "flight_count": 319,
    "total_distance": 154848,
    "percent_of_flights": 0.0009251015726726735
  },
  {
    "origin_name": "HPN - WHITE PLAINS",
    "flight_count": 315,
    "total_distance": 141252,
    "percent_of_flights": 0.00091350155295264
  },
  {
    "origin_name": "BTV - BURLINGTON",
    "flight_count": 307,
    "total_distance": 116219,
    "percent_of_flights": 0.000890301513512573
  },
  {
    "origin_name": "LEX - LEXINGTON",
    "flight_count": 305,
    "total_distance": 109515,
    "percent_of_flights": 0.0008845015036525562
  },
  {
    "origin_name": "AMA - AMARILLO",
    "flight_count": 298,
    "total_distance": 115139,
    "percent_of_flights": 0.0008642014691424975
  },
  {
    "origin_name": "ABI - ABILENE",
    "flight_count": 297,
    "total_distance": 47075,
    "percent_of_flights": 0.0008613014642124892
  },
  {
    "origin_name": "TLH - TALLAHASSEE",
    "flight_count": 285,
    "total_distance": 72773,
    "percent_of_flights": 0.0008265014050523885
  },
  {
    "origin_name": "GPT - GULFPORT",
    "flight_count": 278,
    "total_distance": 98768,
    "percent_of_flights": 0.0008062013705423299
  },
  {
    "origin_name": "BTR - BATON ROUGE",
    "flight_count": 274,
    "total_distance": 102173,
    "percent_of_flights": 0.0007946013508222964
  },
  {
    "origin_name": "MSN - MADISON",
    "flight_count": 271,
    "total_distance": 97792,
    "percent_of_flights": 0.0007859013360322712
  },
  {
    "origin_name": "HNL - HONOLULU",
    "flight_count": 267,
    "total_distance": 763861,
    "percent_of_flights": 0.0007743013163122377
  },
  {
    "origin_name": "GGG - LONGVIEW",
    "flight_count": 258,
    "total_distance": 36120,
    "percent_of_flights": 0.0007482012719421624
  },
  {
    "origin_name": "DSM - DES MOINES",
    "flight_count": 254,
    "total_distance": 141238,
    "percent_of_flights": 0.0007366012522221287
  },
  {
    "origin_name": "GSP - GREER",
    "flight_count": 241,
    "total_distance": 105838,
    "percent_of_flights": 0.0006989011881320199
  },
  {
    "origin_name": "PSP - PALM SPRINGS",
    "flight_count": 240,
    "total_distance": 290300,
    "percent_of_flights": 0.0006960011832020114
  },
  {
    "origin_name": "SJT - SAN ANGELO",
    "flight_count": 223,
    "total_distance": 50937,
    "percent_of_flights": 0.0006467010993918689
  },
  {
    "origin_name": "TXK - TEXARKANA",
    "flight_count": 207,
    "total_distance": 37467,
    "percent_of_flights": 0.0006003010205117349
  },
  {
    "origin_name": "FSM - FORT SMITH",
    "flight_count": 202,
    "total_distance": 45854,
    "percent_of_flights": 0.000585800995861693
  },
  {
    "origin_name": "VLD - VALDOSTA",
    "flight_count": 200,
    "total_distance": 41600,
    "percent_of_flights": 0.0005800009860016763
  },
  {
    "origin_name": "PNS - PENSACOLA",
    "flight_count": 194,
    "total_distance": 90106,
    "percent_of_flights": 0.0005626009564216259
  },
  {
    "origin_name": "SRQ - SARASOTA/BRADENTON",
    "flight_count": 192,
    "total_distance": 152306,
    "percent_of_flights": 0.0005568009465616091
  },
  {
    "origin_name": "SGF - SPRINGFIELD",
    "flight_count": 185,
    "total_distance": 69245,
    "percent_of_flights": 0.0005365009120515505
  },
  {
    "origin_name": "HRL - HARLINGEN",
    "flight_count": 185,
    "total_distance": 51355,
    "percent_of_flights": 0.0005365009120515505
  },
  {
    "origin_name": "ICT - WICHITA",
    "flight_count": 183,
    "total_distance": 84296,
    "percent_of_flights": 0.0005307009021915338
  },
  {
    "origin_name": "CRP - CORPUS CHRISTI",
    "flight_count": 181,
    "total_distance": 42894,
    "percent_of_flights": 0.000524900892331517
  },
  {
    "origin_name": "LFT - LAFAYETTE",
    "flight_count": 176,
    "total_distance": 47848,
    "percent_of_flights": 0.0005104008676814751
  },
  {
    "origin_name": "GRK - FORT HOOD/KILLEEN",
    "flight_count": 161,
    "total_distance": 21830,
    "percent_of_flights": 0.00046690079373134933
  },
  {
    "origin_name": "ROA - ROANOKE",
    "flight_count": 158,
    "total_distance": 49744,
    "percent_of_flights": 0.0004582007789413242
  },
  {
    "origin_name": "MFE - MC ALLEN",
    "flight_count": 154,
    "total_distance": 58848,
    "percent_of_flights": 0.00044660075922129067
  },
  {
    "origin_name": "ILM - WILMINGTON",
    "flight_count": 128,
    "total_distance": 25270,
    "percent_of_flights": 0.00037120063104107277
  },
  {
    "origin_name": "MOB - MOBILE",
    "flight_count": 125,
    "total_distance": 42086,
    "percent_of_flights": 0.0003625006162510476
  },
  {
    "origin_name": "FAI - FAIRBANKS",
    "flight_count": 114,
    "total_distance": 81144,
    "percent_of_flights": 0.00033060056202095545
  },
  {
    "origin_name": "OGG - KAHULUI",
    "flight_count": 110,
    "total_distance": 236105,
    "percent_of_flights": 0.0003190005423009219
  },
  {
    "origin_name": "LRD - LAREDO",
    "flight_count": 107,
    "total_distance": 40185,
    "percent_of_flights": 0.0003103005275108968
  },
  {
    "origin_name": "MCN - MACON",
    "flight_count": 102,
    "total_distance": 8058,
    "percent_of_flights": 0.0002958005028608549
  },
  {
    "origin_name": "BRO - BROWNSVILLE",
    "flight_count": 94,
    "total_distance": 28952,
    "percent_of_flights": 0.0002726004634207878
  },
  {
    "origin_name": "BGR - BANGOR",
    "flight_count": 94,
    "total_distance": 25044,
    "percent_of_flights": 0.0002726004634207878
  },
  {
    "origin_name": "JAC - JACKSON",
    "flight_count": 86,
    "total_distance": 42398,
    "percent_of_flights": 0.00024940042398072075
  },
  {
    "origin_name": "FAR - FARGO",
    "flight_count": 83,
    "total_distance": 18509,
    "percent_of_flights": 0.00024070040919069562
  },
  {
    "origin_name": "FAY - FAYETTEVILLE",
    "flight_count": 83,
    "total_distance": 27473,
    "percent_of_flights": 0.00024070040919069562
  },
  {
    "origin_name": "FNT - FLINT",
    "flight_count": 83,
    "total_distance": 25384,
    "percent_of_flights": 0.00024070040919069562
  },
  {
    "origin_name": "AEX - ALEXANDRIA",
    "flight_count": 80,
    "total_distance": 18930,
    "percent_of_flights": 0.0002320003944006705
  },
  {
    "origin_name": "BPT - BEAUMONT/PORT ARTHUR",
    "flight_count": 77,
    "total_distance": 13914,
    "percent_of_flights": 0.00022330037961064533
  },
  {
    "origin_name": "STT - CHARLOTTE AMALIE",
    "flight_count": 76,
    "total_distance": 38399,
    "percent_of_flights": 0.00022040037468063696
  },
  {
    "origin_name": "PIE - ST PETERSBURG-CLEARWATER",
    "flight_count": 65,
    "total_distance": 77331,
    "percent_of_flights": 0.00018850032045054476
  },
  {
    "origin_name": "BZN - BOZEMAN",
    "flight_count": 62,
    "total_distance": 54715,
    "percent_of_flights": 0.00017980030566051963
  },
  {
    "origin_name": "FAT - FRESNO",
    "flight_count": 57,
    "total_distance": 74841,
    "percent_of_flights": 0.00016530028101047772
  },
  {
    "origin_name": "AVP - WILKES-BARRE/SCRANTON",
    "flight_count": 51,
    "total_distance": 16200,
    "percent_of_flights": 0.00014790025143042744
  },
  {
    "origin_name": "GRB - GREEN BAY",
    "flight_count": 47,
    "total_distance": 15120,
    "percent_of_flights": 0.0001363002317103939
  },
  {
    "origin_name": "EVV - EVANSVILLE",
    "flight_count": 42,
    "total_distance": 8400,
    "percent_of_flights": 0.000121800207060352
  },
  {
    "origin_name": "MSO - MISSOULA",
    "flight_count": 41,
    "total_distance": 41533,
    "percent_of_flights": 0.00011890020213034362
  },
  {
    "origin_name": "LCH - LAKE CHARLES",
    "flight_count": 41,
    "total_distance": 5207,
    "percent_of_flights": 0.00011890020213034362
  },
  {
    "origin_name": "LAN - LANSING",
    "flight_count": 40,
    "total_distance": 7008,
    "percent_of_flights": 0.00011600019720033524
  },
  {
    "origin_name": "TOL - TOLEDO",
    "flight_count": 40,
    "total_distance": 8404,
    "percent_of_flights": 0.00011600019720033524
  },
  {
    "origin_name": "CID - CEDAR RAPIDS",
    "flight_count": 40,
    "total_distance": 15320,
    "percent_of_flights": 0.00011600019720033524
  },
  {
    "origin_name": "DLH - DULUTH",
    "flight_count": 40,
    "total_distance": 5760,
    "percent_of_flights": 0.00011600019720033524
  },
  {
    "origin_name": "GTR - COLUMBUS/W POINT/STARKVILL",
    "flight_count": 37,
    "total_distance": 9478,
    "percent_of_flights": 0.0001073001824103101
  },
  {
    "origin_name": "MEI - MERIDIAN",
    "flight_count": 37,
    "total_distance": 9463,
    "percent_of_flights": 0.0001073001824103101
  },
  {
    "origin_name": "FSD - SIOUX FALLS",
    "flight_count": 35,
    "total_distance": 12339,
    "percent_of_flights": 0.00010150017255029334
  },
  {
    "origin_name": "CRW - CHARLESTON",
    "flight_count": 32,
    "total_distance": 10055,
    "percent_of_flights": 0.00009280015776026819
  },
  {
    "origin_name": "MTJ - MONTROSE",
    "flight_count": 32,
    "total_distance": 26853,
    "percent_of_flights": 0.00009280015776026819
  },
  {
    "origin_name": "CAK - AKRON",
    "flight_count": 32,
    "total_distance": 8444,
    "percent_of_flights": 0.00009280015776026819
  },
  {
    "origin_name": "FWA - FORT WAYNE",
    "flight_count": 31,
    "total_distance": 5332,
    "percent_of_flights": 0.00008990015283025982
  },
  {
    "origin_name": "DAB - DAYTONA BEACH",
    "flight_count": 31,
    "total_distance": 26035,
    "percent_of_flights": 0.00008990015283025982
  },
  {
    "origin_name": "SBN - SOUTH BEND",
    "flight_count": 25,
    "total_distance": 6013,
    "percent_of_flights": 0.00007250012325020953
  },
  {
    "origin_name": "KOA - KAILUA/KONA",
    "flight_count": 24,
    "total_distance": 64144,
    "percent_of_flights": 0.00006960011832020114
  },
  {
    "origin_name": "EGE - EAGLE",
    "flight_count": 24,
    "total_distance": 13363,
    "percent_of_flights": 0.00006960011832020114
  },
  {
    "origin_name": "ATW - APPLETON",
    "flight_count": 24,
    "total_distance": 11634,
    "percent_of_flights": 0.00006960011832020114
  },
  {
    "origin_name": "RAP - RAPID CITY",
    "flight_count": 22,
    "total_distance": 10780,
    "percent_of_flights": 0.00006380010846018439
  },
  {
    "origin_name": "ERI - ERIE",
    "flight_count": 21,
    "total_distance": 4359,
    "percent_of_flights": 0.000060900103530176
  },
  {
    "origin_name": "EFD - HOUSTON",
    "flight_count": 21,
    "total_distance": 588,
    "percent_of_flights": 0.000060900103530176
  },
  {
    "origin_name": "AZO - KALAMAZOO",
    "flight_count": 19,
    "total_distance": 4275,
    "percent_of_flights": 0.00005510009367015924
  },
  {
    "origin_name": "ACY - ATLANTIC CITY",
    "flight_count": 18,
    "total_distance": 9756,
    "percent_of_flights": 0.000052200088740150856
  },
  {
    "origin_name": "SBA - SANTA BARBARA",
    "flight_count": 18,
    "total_distance": 22970,
    "percent_of_flights": 0.000052200088740150856
  },
  {
    "origin_name": "GTF - GREAT FALLS",
    "flight_count": 18,
    "total_distance": 10779,
    "percent_of_flights": 0.000052200088740150856
  },
  {
    "origin_name": "MLI - MOLINE",
    "flight_count": 17,
    "total_distance": 5950,
    "percent_of_flights": 0.00004930008381014248
  },
  {
    "origin_name": "FCA - KALISPELL",
    "flight_count": 17,
    "total_distance": 11282,
    "percent_of_flights": 0.00004930008381014248
  },
  {
    "origin_name": "BIL - BILLINGS",
    "flight_count": 15,
    "total_distance": 9217,
    "percent_of_flights": 0.000043500073950125713
  },
  {
    "origin_name": "MLU - MONROE",
    "flight_count": 15,
    "total_distance": 4240,
    "percent_of_flights": 0.000043500073950125713
  },
  {
    "origin_name": "ACK - NANTUCKET",
    "flight_count": 15,
    "total_distance": 3270,
    "percent_of_flights": 0.000043500073950125713
  },
  {
    "origin_name": " - ",
    "flight_count": 14,
    "total_distance": 5362,
    "percent_of_flights": 0.00004060006902011734
  },
  {
    "origin_name": "LYH - LYNCHBURG",
    "flight_count": 14,
    "total_distance": 5100,
    "percent_of_flights": 0.00004060006902011734
  },
  {
    "origin_name": "SWF - NEWBURGH",
    "flight_count": 13,
    "total_distance": 7579,
    "percent_of_flights": 0.000037700064090108954
  },
  {
    "origin_name": "BGM - BINGHAMTON",
    "flight_count": 13,
    "total_distance": 6068,
    "percent_of_flights": 0.000037700064090108954
  },
  {
    "origin_name": "ORH - WORCESTER",
    "flight_count": 12,
    "total_distance": 1800,
    "percent_of_flights": 0.00003480005916010057
  },
  {
    "origin_name": "HDN - HAYDEN",
    "flight_count": 12,
    "total_distance": 9924,
    "percent_of_flights": 0.00003480005916010057
  },
  {
    "origin_name": "MLB - MELBOURNE",
    "flight_count": 10,
    "total_distance": 7448,
    "percent_of_flights": 0.00002900004930008381
  },
  {
    "origin_name": "BFL - BAKERSFIELD",
    "flight_count": 9,
    "total_distance": 12852,
    "percent_of_flights": 0.000026100044370075428
  },
  {
    "origin_name": "CHO - CHARLOTTESVILLE",
    "flight_count": 9,
    "total_distance": 3078,
    "percent_of_flights": 0.000026100044370075428
  },
  {
    "origin_name": "BQN - AGUADILLA",
    "flight_count": 9,
    "total_distance": 14184,
    "percent_of_flights": 0.000026100044370075428
  },
  {
    "origin_name": "LNK - LINCOLN",
    "flight_count": 9,
    "total_distance": 4108,
    "percent_of_flights": 0.000026100044370075428
  },
  {
    "origin_name": "CMI - CHAMPAIGN/URBANA",
    "flight_count": 8,
    "total_distance": 1640,
    "percent_of_flights": 0.000023200039440067048
  },
  {
    "origin_name": "GUC - GUNNISON",
    "flight_count": 7,
    "total_distance": 1590,
    "percent_of_flights": 0.00002030003451005867
  },
  {
    "origin_name": "ABY - ALBANY",
    "flight_count": 6,
    "total_distance": 876,
    "percent_of_flights": 0.000017400029580050285
  },
  {
    "origin_name": "DRO - DURANGO",
    "flight_count": 5,
    "total_distance": 3565,
    "percent_of_flights": 0.000014500024650041906
  },
  {
    "origin_name": "HLN - HELENA",
    "flight_count": 5,
    "total_distance": 2010,
    "percent_of_flights": 0.000014500024650041906
  },
  {
    "origin_name": "BIS - BISMARCK",
    "flight_count": 5,
    "total_distance": 1930,
    "percent_of_flights": 0.000014500024650041906
  },
  {
    "origin_name": "EUG - EUGENE",
    "flight_count": 5,
    "total_distance": 2255,
    "percent_of_flights": 0.000014500024650041906
  },
  {
    "origin_name": "HTS - HUNTINGTON",
    "flight_count": 4,
    "total_distance": 711,
    "percent_of_flights": 0.000011600019720033524
  },
  {
    "origin_name": "HVN - NEW HAVEN",
    "flight_count": 4,
    "total_distance": 2568,
    "percent_of_flights": 0.000011600019720033524
  },
  {
    "origin_name": "VCT - VICTORIA",
    "flight_count": 3,
    "total_distance": 369,
    "percent_of_flights": 0.000008700014790025143
  },
  {
    "origin_name": "MRY - MONTEREY",
    "flight_count": 3,
    "total_distance": 231,
    "percent_of_flights": 0.000008700014790025143
  },
  {
    "origin_name": "STX - CHRISTIANSTED",
    "flight_count": 3,
    "total_distance": 4686,
    "percent_of_flights": 0.000008700014790025143
  },
  {
    "origin_name": "EYW - KEY WEST",
    "flight_count": 3,
    "total_distance": 435,
    "percent_of_flights": 0.000008700014790025143
  },
  {
    "origin_name": "PSE - PONCE",
    "flight_count": 3,
    "total_distance": 4851,
    "percent_of_flights": 0.000008700014790025143
  },
  {
    "origin_name": "BQK - BRUNSWICK",
    "flight_count": 2,
    "total_distance": 476,
    "percent_of_flights": 0.000005800009860016762
  },
  {
    "origin_name": "TVC - TRAVERSE CITY",
    "flight_count": 2,
    "total_distance": 603,
    "percent_of_flights": 0.000005800009860016762
  },
  {
    "origin_name": "FLO - FLORENCE",
    "flight_count": 1,
    "total_distance": 273,
    "percent_of_flights": 0.000002900004930008381
  },
  {
    "origin_name": "PHF - NEWPORT NEWS",
    "flight_count": 1,
    "total_distance": 465,
    "percent_of_flights": 0.000002900004930008381
  },
  {
    "origin_name": "ITH - ITHACA",
    "flight_count": 1,
    "total_distance": 32,
    "percent_of_flights": 0.000002900004930008381
  },
  {
    "origin_name": "MFR - MEDFORD",
    "flight_count": 1,
    "total_distance": 329,
    "percent_of_flights": 0.000002900004930008381
  },
  {
    "origin_name": "LSE - LA CROSSE",
    "flight_count": 1,
    "total_distance": 215,
    "percent_of_flights": 0.000002900004930008381
  },
  {
    "origin_name": "ELM - ELMIRA/CORNING",
    "flight_count": 1,
    "total_distance": 208,
    "percent_of_flights": 0.000002900004930008381
  }
]
WITH __stage0 AS (
  SELECT
    group_set,
    CASE WHEN group_set=1 THEN
      CONCAT(origin_0."code",' - ',origin_0."city")
      END as "origin_name__1",
    CASE WHEN group_set=1 THEN
      COUNT( 1)
      END as "flight_count__1",
    CASE WHEN group_set=1 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__1",
    (CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=0 THEN
      COUNT( 1)
      END)) OVER () as "percent_of_flights__1"
  FROM '../../documentation/data/flights.parquet' as flights
   LEFT JOIN '../../documentation/data/airports.parquet' AS origin_0
    ON origin_0."code"=flights."origin"
  CROSS JOIN (SELECT UNNEST(GENERATE_SERIES(0,1,1)) as group_set  ) as group_set
  GROUP BY 1,2
)
SELECT
  "origin_name__1" as "origin_name",
  MAX(CASE WHEN group_set=1 THEN "flight_count__1" END) as "flight_count",
  MAX(CASE WHEN group_set=1 THEN "total_distance__1" END) as "total_distance",
  MAX(CASE WHEN group_set=1 THEN "percent_of_flights__1" END) as "percent_of_flights"
FROM __stage0
WHERE group_set NOT IN (0)
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Metric by Manufacturer

document
run: flights -> plane_manufacturer + metrics
QUERY RESULTS
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
BOEING183,236131,710,78553.14%
AIRBUS INDUSTRIE55,99456,029,89716.24%
MCDONNELL DOUGLAS39,10635,767,94611.34%
EMBRAER21,79910,816,9146.32%
AIRBUS7,6997,615,1222.23%
AEROSPATIALE/ALENIA7,4791,476,0372.17%
AEROSPATIALE7,2441,443,4732.1%
SAAB-SCANIA6,3951,096,0931.85%
SHORT BROS5,5731,059,0671.62%
CANADAIR4,4201,997,3591.28%
BOMBARDIER INC3,9012,096,2991.13%
PAIR MIKE E1,6353,825,9980.47%
LOCKHEED346402,2050.1%
[
  {
    "plane_manufacturer": "BOEING",
    "flight_count": 183236,
    "total_distance": 131710785,
    "percent_of_flights": 0.5313853033550157
  },
  {
    "plane_manufacturer": "AIRBUS INDUSTRIE",
    "flight_count": 55994,
    "total_distance": 56029897,
    "percent_of_flights": 0.16238287605088927
  },
  {
    "plane_manufacturer": "MCDONNELL DOUGLAS",
    "flight_count": 39106,
    "total_distance": 35767946,
    "percent_of_flights": 0.11340759279290775
  },
  {
    "plane_manufacturer": "EMBRAER",
    "flight_count": 21799,
    "total_distance": 10816914,
    "percent_of_flights": 0.0632172074692527
  },
  {
    "plane_manufacturer": "AIRBUS",
    "flight_count": 7699,
    "total_distance": 7615122,
    "percent_of_flights": 0.022327137956134526
  },
  {
    "plane_manufacturer": "AEROSPATIALE/ALENIA",
    "flight_count": 7479,
    "total_distance": 1476037,
    "percent_of_flights": 0.02168913687153268
  },
  {
    "plane_manufacturer": "AEROSPATIALE",
    "flight_count": 7244,
    "total_distance": 1443473,
    "percent_of_flights": 0.021007635712980713
  },
  {
    "plane_manufacturer": "SAAB-SCANIA",
    "flight_count": 6395,
    "total_distance": 1096093,
    "percent_of_flights": 0.018545531527403597
  },
  {
    "plane_manufacturer": "SHORT BROS",
    "flight_count": 5573,
    "total_distance": 1059067,
    "percent_of_flights": 0.01616172747493671
  },
  {
    "plane_manufacturer": "CANADAIR",
    "flight_count": 4420,
    "total_distance": 1997359,
    "percent_of_flights": 0.012818021790637044
  },
  {
    "plane_manufacturer": "BOMBARDIER INC",
    "flight_count": 3901,
    "total_distance": 2096299,
    "percent_of_flights": 0.011312919231962695
  },
  {
    "plane_manufacturer": "PAIR MIKE E",
    "flight_count": 1635,
    "total_distance": 3825998,
    "percent_of_flights": 0.004741508060563703
  },
  {
    "plane_manufacturer": "LOCKHEED",
    "flight_count": 346,
    "total_distance": 402205,
    "percent_of_flights": 0.0010034017057829
  }
]
WITH __stage0 AS (
  SELECT
    group_set,
    CASE WHEN group_set=1 THEN
      aircraft_models_0."manufacturer"
      END as "plane_manufacturer__1",
    CASE WHEN group_set=1 THEN
      COUNT( 1)
      END as "flight_count__1",
    CASE WHEN group_set=1 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__1",
    (CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=0 THEN
      COUNT( 1)
      END)) OVER () as "percent_of_flights__1"
  FROM '../../documentation/data/flights.parquet' as flights
   LEFT JOIN '../../documentation/data/aircraft.parquet' AS aircraft_0
    ON aircraft_0."tail_num"=flights."tail_num"
   LEFT JOIN '../../documentation/data/aircraft_models.parquet' AS aircraft_models_0
    ON aircraft_models_0."aircraft_model_code"=aircraft_0."aircraft_model_code"
  CROSS JOIN (SELECT UNNEST(GENERATE_SERIES(0,1,1)) as group_set  ) as group_set
  GROUP BY 1,2
)
SELECT
  "plane_manufacturer__1" as "plane_manufacturer",
  MAX(CASE WHEN group_set=1 THEN "flight_count__1" END) as "flight_count",
  MAX(CASE WHEN group_set=1 THEN "total_distance__1" END) as "total_distance",
  MAX(CASE WHEN group_set=1 THEN "percent_of_flights__1" END) as "percent_of_flights"
FROM __stage0
WHERE group_set NOT IN (0)
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Nesting

One of the really powerful features of the Malloy language is nesting. We can see which carriers fly which airplanes.

document
run: flights -> plane_manufacturer + metrics + {
  nest: carrier_name + aircraft_count
}
QUERY RESULTS
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flightscarrier_​name
BOEING183,236131,710,78553.14%
carrier_​nameaircraft_​count
Southwest8
Delta4
Northwest3
USAir2
United2
America West1
American1
Continental1
ATA1
AIRBUS INDUSTRIE55,99456,029,89716.24%
carrier_​nameaircraft_​count
United3
Northwest2
USAir2
Jetblue1
MCDONNELL DOUGLAS39,10635,767,94611.34%
carrier_​nameaircraft_​count
American4
Alaska1
EMBRAER21,79910,816,9146.32%
carrier_​nameaircraft_​count
Continental Express4
USAir2
Atlantic Southeast1
AIRBUS7,6997,615,1222.23%
carrier_​nameaircraft_​count
Northwest1
Jetblue1
United1
AEROSPATIALE/ALENIA7,4791,476,0372.17%
carrier_​nameaircraft_​count
Atlantic Southeast1
AEROSPATIALE7,2441,443,4732.1%
carrier_​nameaircraft_​count
Atlantic Southeast1
SAAB-SCANIA6,3951,096,0931.85%
carrier_​nameaircraft_​count
American Eagle2
SHORT BROS5,5731,059,0671.62%
carrier_​nameaircraft_​count
American Eagle1
CANADAIR4,4201,997,3591.28%
carrier_​nameaircraft_​count
Comair1
BOMBARDIER INC3,9012,096,2991.13%
carrier_​nameaircraft_​count
American Eagle1
PAIR MIKE E1,6353,825,9980.47%
carrier_​nameaircraft_​count
American1
LOCKHEED346402,2050.1%
carrier_​nameaircraft_​count
Delta1
[
  {
    "plane_manufacturer": "BOEING",
    "flight_count": 183236,
    "total_distance": 131710785,
    "percent_of_flights": 0.5313853033550157,
    "carrier_name": [
      {
        "carrier_name": "Southwest",
        "aircraft_count": 8
      },
      {
        "carrier_name": "Delta",
        "aircraft_count": 4
      },
      {
        "carrier_name": "Northwest",
        "aircraft_count": 3
      },
      {
        "carrier_name": "USAir",
        "aircraft_count": 2
      },
      {
        "carrier_name": "United",
        "aircraft_count": 2
      },
      {
        "carrier_name": "America West",
        "aircraft_count": 1
      },
      {
        "carrier_name": "American",
        "aircraft_count": 1
      },
      {
        "carrier_name": "Continental",
        "aircraft_count": 1
      },
      {
        "carrier_name": "ATA",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "AIRBUS INDUSTRIE",
    "flight_count": 55994,
    "total_distance": 56029897,
    "percent_of_flights": 0.16238287605088927,
    "carrier_name": [
      {
        "carrier_name": "United",
        "aircraft_count": 3
      },
      {
        "carrier_name": "Northwest",
        "aircraft_count": 2
      },
      {
        "carrier_name": "USAir",
        "aircraft_count": 2
      },
      {
        "carrier_name": "Jetblue",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "MCDONNELL DOUGLAS",
    "flight_count": 39106,
    "total_distance": 35767946,
    "percent_of_flights": 0.11340759279290775,
    "carrier_name": [
      {
        "carrier_name": "American",
        "aircraft_count": 4
      },
      {
        "carrier_name": "Alaska",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "EMBRAER",
    "flight_count": 21799,
    "total_distance": 10816914,
    "percent_of_flights": 0.0632172074692527,
    "carrier_name": [
      {
        "carrier_name": "Continental Express",
        "aircraft_count": 4
      },
      {
        "carrier_name": "USAir",
        "aircraft_count": 2
      },
      {
        "carrier_name": "Atlantic Southeast",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "AIRBUS",
    "flight_count": 7699,
    "total_distance": 7615122,
    "percent_of_flights": 0.022327137956134526,
    "carrier_name": [
      {
        "carrier_name": "Northwest",
        "aircraft_count": 1
      },
      {
        "carrier_name": "Jetblue",
        "aircraft_count": 1
      },
      {
        "carrier_name": "United",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "AEROSPATIALE/ALENIA",
    "flight_count": 7479,
    "total_distance": 1476037,
    "percent_of_flights": 0.02168913687153268,
    "carrier_name": [
      {
        "carrier_name": "Atlantic Southeast",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "AEROSPATIALE",
    "flight_count": 7244,
    "total_distance": 1443473,
    "percent_of_flights": 0.021007635712980713,
    "carrier_name": [
      {
        "carrier_name": "Atlantic Southeast",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "SAAB-SCANIA",
    "flight_count": 6395,
    "total_distance": 1096093,
    "percent_of_flights": 0.018545531527403597,
    "carrier_name": [
      {
        "carrier_name": "American Eagle",
        "aircraft_count": 2
      }
    ]
  },
  {
    "plane_manufacturer": "SHORT BROS",
    "flight_count": 5573,
    "total_distance": 1059067,
    "percent_of_flights": 0.01616172747493671,
    "carrier_name": [
      {
        "carrier_name": "American Eagle",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "CANADAIR",
    "flight_count": 4420,
    "total_distance": 1997359,
    "percent_of_flights": 0.012818021790637044,
    "carrier_name": [
      {
        "carrier_name": "Comair",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "BOMBARDIER INC",
    "flight_count": 3901,
    "total_distance": 2096299,
    "percent_of_flights": 0.011312919231962695,
    "carrier_name": [
      {
        "carrier_name": "American Eagle",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "PAIR MIKE E",
    "flight_count": 1635,
    "total_distance": 3825998,
    "percent_of_flights": 0.004741508060563703,
    "carrier_name": [
      {
        "carrier_name": "American",
        "aircraft_count": 1
      }
    ]
  },
  {
    "plane_manufacturer": "LOCKHEED",
    "flight_count": 346,
    "total_distance": 402205,
    "percent_of_flights": 0.0010034017057829,
    "carrier_name": [
      {
        "carrier_name": "Delta",
        "aircraft_count": 1
      }
    ]
  }
]
WITH __stage0 AS (
  SELECT
    group_set,
    CASE WHEN group_set IN (1,2) THEN
      aircraft_models_0."manufacturer"
      END as "plane_manufacturer__1",
    CASE WHEN group_set=1 THEN
      COUNT( 1)
      END as "flight_count__1",
    CASE WHEN group_set=1 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__1",
    (CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=0 THEN
      COUNT( 1)
      END)) OVER () as "percent_of_flights__1",
    CASE WHEN group_set=2 THEN
      carriers_0."nickname"
      END as "carrier_name__2",
    CASE WHEN group_set=2 THEN
      COUNT(DISTINCT aircraft_0."tail_num")
      END as "aircraft_count__2"
  FROM '../../documentation/data/flights.parquet' as flights
   LEFT JOIN '../../documentation/data/aircraft.parquet' AS aircraft_0
    ON aircraft_0."tail_num"=flights."tail_num"
   LEFT JOIN '../../documentation/data/aircraft_models.parquet' AS aircraft_models_0
    ON aircraft_models_0."aircraft_model_code"=aircraft_0."aircraft_model_code"
   LEFT JOIN '../../documentation/data/carriers.parquet' AS carriers_0
    ON carriers_0."code"=flights."carrier"
  CROSS JOIN (SELECT UNNEST(GENERATE_SERIES(0,2,1)) as group_set  ) as group_set
  GROUP BY 1,2,6
)
SELECT
  "plane_manufacturer__1" as "plane_manufacturer",
  MAX(CASE WHEN group_set=1 THEN "flight_count__1" END) as "flight_count",
  MAX(CASE WHEN group_set=1 THEN "total_distance__1" END) as "total_distance",
  MAX(CASE WHEN group_set=1 THEN "percent_of_flights__1" END) as "percent_of_flights",
  COALESCE(LIST({
    "carrier_name": "carrier_name__2", 
    "aircraft_count": "aircraft_count__2"}  ORDER BY  "aircraft_count__2" desc NULLS LAST) FILTER (WHERE group_set=2),[]) as "carrier_name"
FROM __stage0
WHERE group_set NOT IN (0)
GROUP BY 1
ORDER BY 2 desc NULLS LAST

Nesting multiple queries

More than one query can be nested.

document
run: flights -> by_carrier + {
  nest: plane_manufacturer + metrics
  nest: origin_name + metrics + {limit: 5}
}
QUERY RESULTS
carrierflight_​counttotal_​distancepercent_​of_​flightsplane_​manufacturerorigin_​name
WN - Southwest88,75154,619,15225.74%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
BOEING88,75154,619,152100%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
PHX - PHOENIX6,4564,842,2227.27%
LAS - LAS VEGAS6,2924,196,4507.09%
BWI - BALTIMORE5,4713,597,7226.16%
MDW - CHICAGO4,7023,395,6235.3%
LAX - LOS ANGELES4,2822,637,0544.82%
US - USAir37,68323,721,64210.93%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
BOEING16,5927,986,21344.03%
AIRBUS INDUSTRIE16,41212,848,14743.55%
EMBRAER4,6792,887,28212.42%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
CLT - CHARLOTTE6,4273,608,92317.06%
PHL - PHILADELPHIA5,7793,806,53215.34%
PIT - PITTSBURGH4,1372,834,66710.98%
DCA - WASHINGTON2,9001,399,6957.7%
LGA - NEW YORK1,412579,7913.75%
AA - American34,57737,684,88510.03%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
MCDONNELL DOUGLAS30,65328,695,49588.65%
BOEING2,2895,163,3926.62%
PAIR MIKE E1,6353,825,9984.73%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
DFW - DALLAS-FORT WORTH8,7428,419,98725.28%
ORD - CHICAGO5,1435,207,20214.87%
LAX - LOS ANGELES1,9513,451,1945.64%
LGA - NEW YORK1,0701,055,2543.09%
MIA - MIAMI1,0631,301,2013.07%
NW - Northwest33,58033,376,5039.74%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
AIRBUS INDUSTRIE15,72414,438,25846.83%
BOEING15,27416,662,20145.49%
AIRBUS2,5822,276,0447.69%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
MSP - MINNEAPOLIS8,6628,952,18725.8%
DTW - DETROIT6,6045,871,61419.67%
MEM - MEMPHIS1,9841,791,6315.91%
LAX - LOS ANGELES9931,642,0052.96%
MCO - ORLANDO847868,7712.52%
UA - United32,75738,882,9349.5%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
AIRBUS INDUSTRIE19,46522,868,41759.42%
BOEING8,62411,252,65226.33%
AIRBUS4,6684,761,86514.25%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
ORD - CHICAGO6,8027,706,65520.77%
DEN - DENVER4,9975,273,97815.25%
IAD - WASHINGTON2,5413,785,0807.76%
SFO - SAN FRANCISCO2,4643,222,1787.52%
LAX - LOS ANGELES2,3193,441,4497.08%
DL - Delta32,13021,547,8749.32%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
BOEING31,78421,145,66998.92%
LOCKHEED346402,2051.08%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
ATL - ATLANTA8,4195,793,00426.2%
LGA - NEW YORK3,295892,51410.26%
DCA - WASHINGTON1,967442,7466.12%
BOS - BOSTON1,721967,5915.36%
MCO - ORLANDO1,6401,435,8795.1%
RU - Continental Express16,0747,676,7664.66%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
EMBRAER16,0747,676,766100%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
CLE - CLEVELAND3,0071,138,07818.71%
IAH - HOUSTON2,8611,634,76417.8%
EWR - NEWARK2,1701,078,25713.5%
CLT - CHARLOTTE251149,5101.56%
DAY - DAYTON23677,7871.47%
MQ - American Eagle15,8694,251,4594.6%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
SAAB-SCANIA6,3951,096,09340.3%
SHORT BROS5,5731,059,06735.12%
BOMBARDIER INC3,9012,096,29924.58%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
DFW - DALLAS-FORT WORTH6,1461,464,01138.73%
ORD - CHICAGO985463,4916.21%
ACT - WACO49443,9663.11%
TYR - TYLER48049,4403.02%
SPS - WICHITA FALLS45751,6412.88%
EV - Atlantic Southeast15,7693,172,3764.57%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
AEROSPATIALE/ALENIA7,4791,476,03747.43%
AEROSPATIALE7,2441,443,47345.94%
EMBRAER1,046252,8666.63%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
ATL - ATLANTA7,3921,473,93346.88%
PFN - PANAMA CITY776191,6724.92%
AGS - AUGUSTA716102,3884.54%
CHA - CHATTANOOGA68474,9124.34%
CSG - COLUMBUS65454,2824.15%
HP - America West9,7506,441,7072.83%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
BOEING9,7506,441,707100%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
PHX - PHOENIX3,6962,620,47937.91%
LAS - LAS VEGAS1,221596,84912.52%
SNA - SANTA ANA420130,2504.31%
SMF - SACRAMENTO376212,0053.86%
DEN - DENVER302183,4513.1%
AS - Alaska8,4537,072,4512.45%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
MCDONNELL DOUGLAS8,4537,072,451100%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
SEA - SEATTLE3,0302,633,11135.85%
PDX - PORTLAND1,038834,65712.28%
LAX - LOS ANGELES695598,4448.22%
LAS - LAS VEGAS418348,1564.94%
ANC - ANCHORAGE398492,4844.71%
CO - Continental7,1395,794,5722.07%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
BOEING7,1395,794,572100%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
IAH - HOUSTON1,9701,699,83427.59%
EWR - NEWARK1,061800,69414.86%
CLE - CLEVELAND703558,4919.85%
BOS - BOSTON270188,5193.78%
ATL - ATLANTA248181,0743.47%
B6 - Jetblue4,8426,452,2881.4%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
AIRBUS INDUSTRIE4,3935,875,07590.73%
AIRBUS449577,2139.27%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
JFK - NEW YORK1,7522,320,49536.18%
LGB - LONG BEACH471734,4399.73%
FLL - FORT LAUDERDALE375422,7827.74%
OAK - OAKLAND297493,8406.13%
MCO - ORLANDO245241,1265.06%
OH - Comair4,4201,997,3591.28%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
CANADAIR4,4201,997,359100%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
CVG - COVINGTON/CINCINNATI, OH1,514617,44334.25%
ATL - ATLANTA239130,3495.41%
LGA - NEW YORK185116,4574.19%
JFK - NEW YORK13677,4823.08%
MCO - ORLANDO9148,2882.06%
TZ - ATA3,0332,645,2270.88%
plane_​manufacturerflight_​counttotal_​distancepercent_​of_​flights
BOEING3,0332,645,227100%
origin_​nameflight_​counttotal_​distancepercent_​of_​flights
MDW - CHICAGO1,3091,091,99943.16%
LGA - NEW YORK210151,1886.92%
IND - INDIANAPOLIS200193,9456.59%
MSP - MINNEAPOLIS16356,8875.37%
DFW - DALLAS-FORT WORTH132104,9244.35%
[
  {
    "carrier": "WN - Southwest",
    "flight_count": 88751,
    "total_distance": 54619152,
    "percent_of_flights": 0.2573783375431738,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "BOEING",
        "flight_count": 88751,
        "total_distance": 54619152,
        "percent_of_flights": 1
      }
    ],
    "origin_name": [
      {
        "origin_name": "PHX - PHOENIX",
        "flight_count": 6456,
        "total_distance": 4842222,
        "percent_of_flights": 0.07274284233417089
      },
      {
        "origin_name": "LAS - LAS VEGAS",
        "flight_count": 6292,
        "total_distance": 4196450,
        "percent_of_flights": 0.07089497583125824
      },
      {
        "origin_name": "BWI - BALTIMORE",
        "flight_count": 5471,
        "total_distance": 3597722,
        "percent_of_flights": 0.061644375838018725
      },
      {
        "origin_name": "MDW - CHICAGO",
        "flight_count": 4702,
        "total_distance": 3395623,
        "percent_of_flights": 0.052979684735946636
      },
      {
        "origin_name": "LAX - LOS ANGELES",
        "flight_count": 4282,
        "total_distance": 2637054,
        "percent_of_flights": 0.04824734369190206
      }
    ]
  },
  {
    "carrier": "US - USAir",
    "flight_count": 37683,
    "total_distance": 23721642,
    "percent_of_flights": 0.10928088577750582,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "BOEING",
        "flight_count": 16592,
        "total_distance": 7986213,
        "percent_of_flights": 0.440304646657644
      },
      {
        "plane_manufacturer": "AIRBUS INDUSTRIE",
        "flight_count": 16412,
        "total_distance": 12848147,
        "percent_of_flights": 0.43552795690364354
      },
      {
        "plane_manufacturer": "EMBRAER",
        "flight_count": 4679,
        "total_distance": 2887282,
        "percent_of_flights": 0.12416739643871241
      }
    ],
    "origin_name": [
      {
        "origin_name": "CLT - CHARLOTTE",
        "flight_count": 6427,
        "total_distance": 3608923,
        "percent_of_flights": 0.17055436138311705
      },
      {
        "origin_name": "PHL - PHILADELPHIA",
        "flight_count": 5779,
        "total_distance": 3806532,
        "percent_of_flights": 0.15335827826871534
      },
      {
        "origin_name": "PIT - PITTSBURGH",
        "flight_count": 4137,
        "total_distance": 2834667,
        "percent_of_flights": 0.10978425284611097
      },
      {
        "origin_name": "DCA - WASHINGTON",
        "flight_count": 2900,
        "total_distance": 1399695,
        "percent_of_flights": 0.0769577793700077
      },
      {
        "origin_name": "LGA - NEW YORK",
        "flight_count": 1412,
        "total_distance": 579791,
        "percent_of_flights": 0.03747047740360375
      }
    ]
  },
  {
    "carrier": "AA - American",
    "flight_count": 34577,
    "total_distance": 37684885,
    "percent_of_flights": 0.10027347046489979,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "MCDONNELL DOUGLAS",
        "flight_count": 30653,
        "total_distance": 28695495,
        "percent_of_flights": 0.8865141568094398
      },
      {
        "plane_manufacturer": "BOEING",
        "flight_count": 2289,
        "total_distance": 5163392,
        "percent_of_flights": 0.06620007519449345
      },
      {
        "plane_manufacturer": "PAIR MIKE E",
        "flight_count": 1635,
        "total_distance": 3825998,
        "percent_of_flights": 0.04728576799606675
      }
    ],
    "origin_name": [
      {
        "origin_name": "DFW - DALLAS-FORT WORTH",
        "flight_count": 8742,
        "total_distance": 8419987,
        "percent_of_flights": 0.25282702374410737
      },
      {
        "origin_name": "ORD - CHICAGO",
        "flight_count": 5143,
        "total_distance": 5207202,
        "percent_of_flights": 0.1487404922347225
      },
      {
        "origin_name": "LAX - LOS ANGELES",
        "flight_count": 1951,
        "total_distance": 3451194,
        "percent_of_flights": 0.056424791046071086
      },
      {
        "origin_name": "LGA - NEW YORK",
        "flight_count": 1070,
        "total_distance": 1055254,
        "percent_of_flights": 0.030945426150331145
      },
      {
        "origin_name": "MIA - MIAMI",
        "flight_count": 1063,
        "total_distance": 1301201,
        "percent_of_flights": 0.03074297943719814
      }
    ]
  },
  {
    "carrier": "NW - Northwest",
    "flight_count": 33580,
    "total_distance": 33376503,
    "percent_of_flights": 0.09738216554968143,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "AIRBUS INDUSTRIE",
        "flight_count": 15724,
        "total_distance": 14438258,
        "percent_of_flights": 0.4682549136390709
      },
      {
        "plane_manufacturer": "BOEING",
        "flight_count": 15274,
        "total_distance": 16662201,
        "percent_of_flights": 0.45485407980941034
      },
      {
        "plane_manufacturer": "AIRBUS",
        "flight_count": 2582,
        "total_distance": 2276044,
        "percent_of_flights": 0.07689100655151876
      }
    ],
    "origin_name": [
      {
        "origin_name": "MSP - MINNEAPOLIS",
        "flight_count": 8662,
        "total_distance": 8952187,
        "percent_of_flights": 0.2579511614055986
      },
      {
        "origin_name": "DTW - DETROIT",
        "flight_count": 6604,
        "total_distance": 5871614,
        "percent_of_flights": 0.19666468135795115
      },
      {
        "origin_name": "MEM - MEMPHIS",
        "flight_count": 1984,
        "total_distance": 1791631,
        "percent_of_flights": 0.05908278737343657
      },
      {
        "origin_name": "LAX - LOS ANGELES",
        "flight_count": 993,
        "total_distance": 1642005,
        "percent_of_flights": 0.029571173317450863
      },
      {
        "origin_name": "MCO - ORLANDO",
        "flight_count": 847,
        "total_distance": 868771,
        "percent_of_flights": 0.025223347230494342
      }
    ]
  },
  {
    "carrier": "UA - United",
    "flight_count": 32757,
    "total_distance": 38882934,
    "percent_of_flights": 0.09499546149228454,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "AIRBUS INDUSTRIE",
        "flight_count": 19465,
        "total_distance": 22868417,
        "percent_of_flights": 0.5942241352993254
      },
      {
        "plane_manufacturer": "BOEING",
        "flight_count": 8624,
        "total_distance": 11252652,
        "percent_of_flights": 0.26327197240284517
      },
      {
        "plane_manufacturer": "AIRBUS",
        "flight_count": 4668,
        "total_distance": 4761865,
        "percent_of_flights": 0.14250389229782948
      }
    ],
    "origin_name": [
      {
        "origin_name": "ORD - CHICAGO",
        "flight_count": 6802,
        "total_distance": 7706655,
        "percent_of_flights": 0.20765027322404372
      },
      {
        "origin_name": "DEN - DENVER",
        "flight_count": 4997,
        "total_distance": 5273978,
        "percent_of_flights": 0.1525475470891718
      },
      {
        "origin_name": "IAD - WASHINGTON",
        "flight_count": 2541,
        "total_distance": 3785080,
        "percent_of_flights": 0.07757120615440974
      },
      {
        "origin_name": "SFO - SAN FRANCISCO",
        "flight_count": 2464,
        "total_distance": 3222178,
        "percent_of_flights": 0.07522056354367006
      },
      {
        "origin_name": "LAX - LOS ANGELES",
        "flight_count": 2319,
        "total_distance": 3441449,
        "percent_of_flights": 0.0707940287572122
      }
    ]
  },
  {
    "carrier": "DL - Delta",
    "flight_count": 32130,
    "total_distance": 21547874,
    "percent_of_flights": 0.09317715840116929,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "BOEING",
        "flight_count": 31784,
        "total_distance": 21145669,
        "percent_of_flights": 0.9892312480547775
      },
      {
        "plane_manufacturer": "LOCKHEED",
        "flight_count": 346,
        "total_distance": 402205,
        "percent_of_flights": 0.010768751945222534
      }
    ],
    "origin_name": [
      {
        "origin_name": "ATL - ATLANTA",
        "flight_count": 8419,
        "total_distance": 5793004,
        "percent_of_flights": 0.2620292561469032
      },
      {
        "origin_name": "LGA - NEW YORK",
        "flight_count": 3295,
        "total_distance": 892514,
        "percent_of_flights": 0.10255213196389668
      },
      {
        "origin_name": "DCA - WASHINGTON",
        "flight_count": 1967,
        "total_distance": 442746,
        "percent_of_flights": 0.06122004357298475
      },
      {
        "origin_name": "BOS - BOSTON",
        "flight_count": 1721,
        "total_distance": 967591,
        "percent_of_flights": 0.05356364768129474
      },
      {
        "origin_name": "MCO - ORLANDO",
        "flight_count": 1640,
        "total_distance": 1435879,
        "percent_of_flights": 0.05104263927793339
      }
    ]
  },
  {
    "carrier": "RU - Continental Express",
    "flight_count": 16074,
    "total_distance": 7676766,
    "percent_of_flights": 0.046614679244954715,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "EMBRAER",
        "flight_count": 16074,
        "total_distance": 7676766,
        "percent_of_flights": 1
      }
    ],
    "origin_name": [
      {
        "origin_name": "CLE - CLEVELAND",
        "flight_count": 3007,
        "total_distance": 1138078,
        "percent_of_flights": 0.18707229065571732
      },
      {
        "origin_name": "IAH - HOUSTON",
        "flight_count": 2861,
        "total_distance": 1634764,
        "percent_of_flights": 0.1779892994898594
      },
      {
        "origin_name": "EWR - NEWARK",
        "flight_count": 2170,
        "total_distance": 1078257,
        "percent_of_flights": 0.1350006221226826
      },
      {
        "origin_name": "CLT - CHARLOTTE",
        "flight_count": 251,
        "total_distance": 149510,
        "percent_of_flights": 0.015615279333084485
      },
      {
        "origin_name": "DAY - DAYTON",
        "flight_count": 236,
        "total_distance": 77787,
        "percent_of_flights": 0.014682095309194973
      }
    ]
  },
  {
    "carrier": "MQ - American Eagle",
    "flight_count": 15869,
    "total_distance": 4251459,
    "percent_of_flights": 0.046020178234302996,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "SAAB-SCANIA",
        "flight_count": 6395,
        "total_distance": 1096093,
        "percent_of_flights": 0.40298695569979204
      },
      {
        "plane_manufacturer": "SHORT BROS",
        "flight_count": 5573,
        "total_distance": 1059067,
        "percent_of_flights": 0.3511878505261831
      },
      {
        "plane_manufacturer": "BOMBARDIER INC",
        "flight_count": 3901,
        "total_distance": 2096299,
        "percent_of_flights": 0.24582519377402484
      }
    ],
    "origin_name": [
      {
        "origin_name": "DFW - DALLAS-FORT WORTH",
        "flight_count": 6146,
        "total_distance": 1464011,
        "percent_of_flights": 0.38729598588442876
      },
      {
        "origin_name": "ORD - CHICAGO",
        "flight_count": 985,
        "total_distance": 463491,
        "percent_of_flights": 0.06207070388808369
      },
      {
        "origin_name": "ACT - WACO",
        "flight_count": 494,
        "total_distance": 43966,
        "percent_of_flights": 0.031129875858592223
      },
      {
        "origin_name": "TYR - TYLER",
        "flight_count": 480,
        "total_distance": 49440,
        "percent_of_flights": 0.030247652656122
      },
      {
        "origin_name": "SPS - WICHITA FALLS",
        "flight_count": 457,
        "total_distance": 51641,
        "percent_of_flights": 0.028798285966349486
      }
    ]
  },
  {
    "carrier": "EV - Atlantic Southeast",
    "flight_count": 15769,
    "total_distance": 3172376,
    "percent_of_flights": 0.04573017774130216,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "AEROSPATIALE/ALENIA",
        "flight_count": 7479,
        "total_distance": 1476037,
        "percent_of_flights": 0.4742849895364322
      },
      {
        "plane_manufacturer": "AEROSPATIALE",
        "flight_count": 7244,
        "total_distance": 1443473,
        "percent_of_flights": 0.4593823324243769
      },
      {
        "plane_manufacturer": "EMBRAER",
        "flight_count": 1046,
        "total_distance": 252866,
        "percent_of_flights": 0.06633267803919082
      }
    ],
    "origin_name": [
      {
        "origin_name": "ATL - ATLANTA",
        "flight_count": 7392,
        "total_distance": 1473933,
        "percent_of_flights": 0.4687678356268628
      },
      {
        "origin_name": "PFN - PANAMA CITY",
        "flight_count": 776,
        "total_distance": 191672,
        "percent_of_flights": 0.049210476250871965
      },
      {
        "origin_name": "AGS - AUGUSTA",
        "flight_count": 716,
        "total_distance": 102388,
        "percent_of_flights": 0.04540554252013444
      },
      {
        "origin_name": "CHA - CHATTANOOGA",
        "flight_count": 684,
        "total_distance": 74912,
        "percent_of_flights": 0.04337624453040776
      },
      {
        "origin_name": "CSG - COLUMBUS",
        "flight_count": 654,
        "total_distance": 54282,
        "percent_of_flights": 0.041473777665039
      }
    ]
  },
  {
    "carrier": "HP - America West",
    "flight_count": 9750,
    "total_distance": 6441707,
    "percent_of_flights": 0.028275048067581715,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "BOEING",
        "flight_count": 9750,
        "total_distance": 6441707,
        "percent_of_flights": 1
      }
    ],
    "origin_name": [
      {
        "origin_name": "PHX - PHOENIX",
        "flight_count": 3696,
        "total_distance": 2620479,
        "percent_of_flights": 0.3790769230769231
      },
      {
        "origin_name": "LAS - LAS VEGAS",
        "flight_count": 1221,
        "total_distance": 596849,
        "percent_of_flights": 0.12523076923076923
      },
      {
        "origin_name": "SNA - SANTA ANA",
        "flight_count": 420,
        "total_distance": 130250,
        "percent_of_flights": 0.043076923076923075
      },
      {
        "origin_name": "SMF - SACRAMENTO",
        "flight_count": 376,
        "total_distance": 212005,
        "percent_of_flights": 0.038564102564102566
      },
      {
        "origin_name": "DEN - DENVER",
        "flight_count": 302,
        "total_distance": 183451,
        "percent_of_flights": 0.030974358974358976
      }
    ]
  },
  {
    "carrier": "AS - Alaska",
    "flight_count": 8453,
    "total_distance": 7072451,
    "percent_of_flights": 0.024513741673360845,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "MCDONNELL DOUGLAS",
        "flight_count": 8453,
        "total_distance": 7072451,
        "percent_of_flights": 1
      }
    ],
    "origin_name": [
      {
        "origin_name": "SEA - SEATTLE",
        "flight_count": 3030,
        "total_distance": 2633111,
        "percent_of_flights": 0.35845262037146575
      },
      {
        "origin_name": "PDX - PORTLAND",
        "flight_count": 1038,
        "total_distance": 834657,
        "percent_of_flights": 0.12279664024606649
      },
      {
        "origin_name": "LAX - LOS ANGELES",
        "flight_count": 695,
        "total_distance": 598444,
        "percent_of_flights": 0.0822193304152372
      },
      {
        "origin_name": "LAS - LAS VEGAS",
        "flight_count": 418,
        "total_distance": 348156,
        "percent_of_flights": 0.04944989944398438
      },
      {
        "origin_name": "ANC - ANCHORAGE",
        "flight_count": 398,
        "total_distance": 492484,
        "percent_of_flights": 0.04708387554714303
      }
    ]
  },
  {
    "carrier": "CO - Continental",
    "flight_count": 7139,
    "total_distance": 5794572,
    "percent_of_flights": 0.020703135195329833,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "BOEING",
        "flight_count": 7139,
        "total_distance": 5794572,
        "percent_of_flights": 1
      }
    ],
    "origin_name": [
      {
        "origin_name": "IAH - HOUSTON",
        "flight_count": 1970,
        "total_distance": 1699834,
        "percent_of_flights": 0.27594901246673204
      },
      {
        "origin_name": "EWR - NEWARK",
        "flight_count": 1061,
        "total_distance": 800694,
        "percent_of_flights": 0.14862025493766634
      },
      {
        "origin_name": "CLE - CLEVELAND",
        "flight_count": 703,
        "total_distance": 558491,
        "percent_of_flights": 0.09847317551477798
      },
      {
        "origin_name": "BOS - BOSTON",
        "flight_count": 270,
        "total_distance": 188519,
        "percent_of_flights": 0.03782042302843536
      },
      {
        "origin_name": "ATL - ATLANTA",
        "flight_count": 248,
        "total_distance": 181074,
        "percent_of_flights": 0.0347387589298221
      }
    ]
  },
  {
    "carrier": "B6 - Jetblue",
    "flight_count": 4842,
    "total_distance": 6452288,
    "percent_of_flights": 0.01404182387110058,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "AIRBUS INDUSTRIE",
        "flight_count": 4393,
        "total_distance": 5875075,
        "percent_of_flights": 0.9072697232548533
      },
      {
        "plane_manufacturer": "AIRBUS",
        "flight_count": 449,
        "total_distance": 577213,
        "percent_of_flights": 0.09273027674514664
      }
    ],
    "origin_name": [
      {
        "origin_name": "JFK - NEW YORK",
        "flight_count": 1752,
        "total_distance": 2320495,
        "percent_of_flights": 0.3618339529120198
      },
      {
        "origin_name": "LGB - LONG BEACH",
        "flight_count": 471,
        "total_distance": 734439,
        "percent_of_flights": 0.09727385377942999
      },
      {
        "origin_name": "FLL - FORT LAUDERDALE",
        "flight_count": 375,
        "total_distance": 422782,
        "percent_of_flights": 0.07744733581164807
      },
      {
        "origin_name": "OAK - OAKLAND",
        "flight_count": 297,
        "total_distance": 493840,
        "percent_of_flights": 0.06133828996282528
      },
      {
        "origin_name": "MCO - ORLANDO",
        "flight_count": 245,
        "total_distance": 241126,
        "percent_of_flights": 0.05059892606361008
      }
    ]
  },
  {
    "carrier": "OH - Comair",
    "flight_count": 4420,
    "total_distance": 1997359,
    "percent_of_flights": 0.012818021790637044,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "CANADAIR",
        "flight_count": 4420,
        "total_distance": 1997359,
        "percent_of_flights": 1
      }
    ],
    "origin_name": [
      {
        "origin_name": "CVG - COVINGTON/CINCINNATI, OH",
        "flight_count": 1514,
        "total_distance": 617443,
        "percent_of_flights": 0.3425339366515837
      },
      {
        "origin_name": "ATL - ATLANTA",
        "flight_count": 239,
        "total_distance": 130349,
        "percent_of_flights": 0.05407239819004525
      },
      {
        "origin_name": "LGA - NEW YORK",
        "flight_count": 185,
        "total_distance": 116457,
        "percent_of_flights": 0.0418552036199095
      },
      {
        "origin_name": "JFK - NEW YORK",
        "flight_count": 136,
        "total_distance": 77482,
        "percent_of_flights": 0.03076923076923077
      },
      {
        "origin_name": "MCO - ORLANDO",
        "flight_count": 91,
        "total_distance": 48288,
        "percent_of_flights": 0.020588235294117647
      }
    ]
  },
  {
    "carrier": "TZ - ATA",
    "flight_count": 3033,
    "total_distance": 2645227,
    "percent_of_flights": 0.00879571495271542,
    "plane_manufacturer": [
      {
        "plane_manufacturer": "BOEING",
        "flight_count": 3033,
        "total_distance": 2645227,
        "percent_of_flights": 1
      }
    ],
    "origin_name": [
      {
        "origin_name": "MDW - CHICAGO",
        "flight_count": 1309,
        "total_distance": 1091999,
        "percent_of_flights": 0.43158588855918234
      },
      {
        "origin_name": "LGA - NEW YORK",
        "flight_count": 210,
        "total_distance": 151188,
        "percent_of_flights": 0.06923837784371908
      },
      {
        "origin_name": "IND - INDIANAPOLIS",
        "flight_count": 200,
        "total_distance": 193945,
        "percent_of_flights": 0.06594131223211341
      },
      {
        "origin_name": "MSP - MINNEAPOLIS",
        "flight_count": 163,
        "total_distance": 56887,
        "percent_of_flights": 0.053742169469172436
      },
      {
        "origin_name": "DFW - DALLAS-FORT WORTH",
        "flight_count": 132,
        "total_distance": 104924,
        "percent_of_flights": 0.043521266073194856
      }
    ]
  }
]
WITH __stage0 AS (
  SELECT
    group_set,
    CASE WHEN group_set IN (1,2,3) THEN
      CONCAT(flights."carrier",' - ',(carriers_0."nickname"))
      END as "carrier__1",
    CASE WHEN group_set=1 THEN
      COUNT( 1)
      END as "flight_count__1",
    CASE WHEN group_set=1 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__1",
    (CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=0 THEN
      COUNT( 1)
      END)) OVER () as "percent_of_flights__1",
    CASE WHEN group_set=2 THEN
      aircraft_models_0."manufacturer"
      END as "plane_manufacturer__2",
    CASE WHEN group_set=2 THEN
      COUNT( 1)
      END as "flight_count__2",
    CASE WHEN group_set=2 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__2",
    (CASE WHEN group_set=2 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)) OVER (PARTITION BY CASE WHEN group_set IN (1,2,3) THEN
      CONCAT(flights."carrier",' - ',(carriers_0."nickname"))
      END) as "percent_of_flights__2",
    CASE WHEN group_set=3 THEN
      CONCAT(origin_0."code",' - ',origin_0."city")
      END as "origin_name__3",
    CASE WHEN group_set=3 THEN
      COUNT( 1)
      END as "flight_count__3",
    CASE WHEN group_set=3 THEN
      COALESCE(SUM(flights."distance"),0)
      END as "total_distance__3",
    (CASE WHEN group_set=3 THEN
      COUNT( 1)
      END)*1.0/MAX((CASE WHEN group_set=1 THEN
      COUNT( 1)
      END)) OVER (PARTITION BY CASE WHEN group_set IN (1,2,3) THEN
      CONCAT(flights."carrier",' - ',(carriers_0."nickname"))
      END) as "percent_of_flights__3"
  FROM '../../documentation/data/flights.parquet' as flights
   LEFT JOIN '../../documentation/data/carriers.parquet' AS carriers_0
    ON carriers_0."code"=flights."carrier"
   LEFT JOIN '../../documentation/data/aircraft.parquet' AS aircraft_0
    ON aircraft_0."tail_num"=flights."tail_num"
   LEFT JOIN '../../documentation/data/aircraft_models.parquet' AS aircraft_models_0
    ON aircraft_models_0."aircraft_model_code"=aircraft_0."aircraft_model_code"
   LEFT JOIN '../../documentation/data/airports.parquet' AS origin_0
    ON origin_0."code"=flights."origin"
  CROSS JOIN (SELECT UNNEST(GENERATE_SERIES(0,3,1)) as group_set  ) as group_set
  GROUP BY 1,2,6,10
)
SELECT
  "carrier__1" as "carrier",
  MAX(CASE WHEN group_set=1 THEN "flight_count__1" END) as "flight_count",
  MAX(CASE WHEN group_set=1 THEN "total_distance__1" END) as "total_distance",
  MAX(CASE WHEN group_set=1 THEN "percent_of_flights__1" END) as "percent_of_flights",
  COALESCE(LIST({
    "plane_manufacturer": "plane_manufacturer__2", 
    "flight_count": "flight_count__2", 
    "total_distance": "total_distance__2", 
    "percent_of_flights": "percent_of_flights__2"}  ORDER BY  "flight_count__2" desc NULLS LAST) FILTER (WHERE group_set=2),[]) as "plane_manufacturer",
  COALESCE(LIST({
    "origin_name": "origin_name__3", 
    "flight_count": "flight_count__3", 
    "total_distance": "total_distance__3", 
    "percent_of_flights": "percent_of_flights__3"}  ORDER BY  "flight_count__3" desc NULLS LAST) FILTER (WHERE group_set=3)[1:5],[]) as "origin_name"
FROM __stage0
WHERE group_set NOT IN (0)
GROUP BY 1
ORDER BY 2 desc NULLS LAST

And there you have it

Writing queries with a pre-built model is really powerful. You can easily explore a complex dataset in a simple, composable way. The output of these queries can be used in lots of different ways, from Data Science to transforming data for consumption in other systems.

Pre-built semantic models take much of the pain out of working with data.