kohera-logo-regular.svg

World Cup Russia: Calculating the travel distance with spatial data

As I start to learn more about SQL, I came across a subject that was new to me: spatial data. I was curious on how it worked so I started looking some things up.

How many kilometers must the Belgium football team travel to play their matches?

After I read some documentation, I started thinking on how spatial data could be used with some ‘real life’ examples. As it happens, I created a fun dashboard in Power Bi with my colleague about the upcoming World Cup in Russia. We used some geographical data there. More specifically, the location of the stadiums of the World Cup in Russia. Now that the schedule of the matches is also out, I thought it might be a good idea to calculate something. For example: how many kilometers must the Belgium football team travel to play their matches?

The base camp of the Belgian football team is in Moscow (more specifically the Moscow Country Club Hotel). They have matches in Kaliningrad (Kaliningrad Stadium), Moscow (Spartak Stadium) and Sochi (Fisht Olympic Stadium). Through the dashboard me and my colleague created, I already had the longitude and latitude of the stadiums. Now all I have to do, is to create the SQL statement.

This query calculates the distance between all the locations. Start of in basecamp and goes to the stadium and back. This is done for every match. The result of the query is:

Apparently, the Belgian football team has to travel 6008,97 km’s (!!) in total. Let’s hope that doesn’t impact their chances on winning the World Cup!

2319-blog-database-specific-security-featured-image
Database specific security in SQL Server
There are many different ways to secure your database. In this blog post we will give most of them a...
kohera-2312-blog-sql-server-level-security-featured-image
SQL Server security on server level
In this blog, we’re going to look at the options we have for server level security. In SQL Server we...
blog-security_1
Microsoft SQL Server history
Since its inception in 1989, Microsoft SQL Server is a critical component of many organizations' data infrastructure. As data has...
DSC_1388
Aggregaties
Power BI Desktop is een prachtige tool om snel data-analyses te kunnen uitvoeren. Je connecteert op een databron, importeert en...
dba image
DBA is not that scary
Often when talking to people who are looking for a career path in the data world I feel like there...
blog-2303
How do you link an SCD Type 2 table in Power Query?
This article uses a simple example to demonstrate how to link an SCD Type 2 table in Power Query to...