Menu

A trip to China is 311 trips, not 44,473 — and four of the six line items are constants
📰

A trip to China is 311 trips, not 44,473 — and four of the six line items are constants

DEV Community: database·jiang Wang·5 days ago
#nfZ1dJnq
#devtodatabase#devto#dev#count#distinct
Reading 0:00
15s threshold

I expected the expensive part of building a travel-cost dataset to be the flights. It turned out to be the opposite: the flights were the only part that needed real modelling, because everything else collapsed into a constant.

The table

44,473 priced routes. 88 origin countries. 311 Chinese destinations. Each row itemises six things — flights, accommodation, food, local transport, attractions, fixed costs (visa, insurance, eSIM, card fees) — and the six sum exactly to the stored total.

The first thing I did after loading it was check whether that "exactly" was true:

SELECT COUNT ( * ) AS bad FROM cost_routes WHERE flight_low + hotel_low + food_low + local_low + acts_low + fixed_low <> total_low ; -- 0

Enter fullscreen mode

Exit fullscreen mode

Good.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.