Shawn Ng

Game of Thrones Relationships

In this project, I used Django framework to design a database model, storing the relationships between GoT characters.

Game of thrones
Image Credit: HBO

Project Overview

With the recent release of Game of Thrones (GoT) season 8, I got the inspiration to do this project. In my previous article Rails VS Django VS Express; I created China Emperor databases to test my database designing skill. However, I feel that my training is incomplete.

The objective of this project is to create a database to store the interesting relationships of specific GoT characters.

I am going to talk about the database design first and my views of specific GoT characters at the end of the article.

I learned the lessons from my previous project CE. This time, I sat down, think about it, drew the database schema before I write any code.

Database schema

Schema
Database schema

I created three tables in this database: Profile, Relationship, and ProfileRelationship.

Profile

Profile
Profile

The profile table will store the general information about the GoT characters.

Date of Birth (DOB) and Date of Death (DOD) is having the right data type this time, SMALLINT

Relationship

Relationship
Relationship

The relationship table is a reference table that stores the possible types of relationships.

ProfileRelationship

Profile relationship
ProfileRelationship

There is a many-to-many relationship between profiles, and ProfileRelationship is the intermediate table.

This video shows the highlight of this project:

Building the relationships between profiles.

SQL

Profile JS
Jon Snow

Come on Jon! I do not hate you. But when you got resurrected, you become an anomaly in my database. When people die, they stay dead. If your DOD is not empty, we expect your status to be dead/others

This SQL will show all the profile relationships:

SELECT
  pr.from_profile_id,
  CONCAT(p1.first_name, ' ', p1.last_name) from_profile_name,
  pr.to_profile_id,
  CONCAT(p2.first_name, ' ', p2.last_name) to_profile_name,
  pr.relationship_id,
  r.name,
  r.description
FROM profile p1, profile p2, profile_relationship pr, relationship r
WHERE p1.id=pr.from_profile_id
AND p2.id=pr.to_profile_id
AND pr.relationship_id=r.id;

The result:

PRPR
Join Profile, Relationship & ProfileRelationship

Daenerys is Jon's aunt, yet they have an intimate relationship. Cersei and Jaime have three children despite being siblings.

My views

Below, I am going to give my opinions about a few GoT characters. To establish some common ground, please note that I only watched HBO's GoT and I never read the books.

Tyrion Lannister

Tyrion Lannister
Tyrion Lannister

If everyone has a defining moment, this is his:

I have a weak spot for weak people who die trying to become stronger and change their destinies.

I would gladly help Tyrion in the trial by combat. Because I like him and I'm confident of my combat skills. Killing the mountain is my chance of becoming the best warrior.

... Just kidding

I am going to hire assassins to kill the mountain the day before the trial, and 2nd strongest man to fight for my side. All the trouble I will go through to save a powerful ally.

Eddard "Ned" Stark

Eddard Stark

In the series, people call Ned a man of his word. He is a caring father of his bastard son: Jon Snow (a rare case in their era).

Ned gives the audience the impression that he is a good man. However, I notice some inconsistencies in this impression.

#1. Ned is not a man of his word

When Cersei Lannister and Joffrey Baratheon forced Ned to lie about Joffrey claim to the throne, Ned obeys. Some may argue that he is doing that to protect his daughters (Sansa and Arya Stark). I disagree. I believe the best way to protect them is: to tell the truth. I predict that the public will rebel against Joffrey when they hear it. The reason is that Joffrey is unlikeable. Joffrey will not execute Ned's daughters to prove that he is a benevolent king.

I believe it's an honorable way to die by staying true to your word. As a true friend to Robert Baratheon, Ned should prevent Joffrey from taking the throne, to protect the realm.

#2. Ned is a horrible husband

We learned that Jon Snow's real name is Aegon Targaryen. Jon is Ned's nephew and not his son.

From Season 3 Episode 2 “Dark Wings, Dark Words”; We learn that Catelyn Stark did not know Jon/Aegon's real parentage. If you are Catelyn, can you stand looking at Jon every day, as a reminder of Ned's betrayal?

Ned should tell Catelyn the truth and not torment her.

Robb Stark

Robb Stark

The King in the North.

#1. Robb shouldn't get married during the war

Getting married during the war is an act of disrespect to it. You are either confident that you will 100% win. Or you are an idiot.

#2. Robb shouldn't create an internal conflict during the war

Robb made a grave mistake by killing Lord Karstark. He lost Karstark's army because of this.

#3. Double standard

Robb killed Lord Karstark for disobeying his order. But Robb did not punish Catelyn (his mother) for releasing Jaime Lannister, which is a bigger mistake.

Margaery Tyrell

Margaery Tyrell

Quick-witted and gorgeous, I hope I can meet someone like her that makes my heart skips a beat

Anyone who can live with Joffrey Baratheon is admirable.

Final thoughts

I love studying wars as I learn valuable lessons about human nature. I think that it is the most beautiful display of desires, beliefs, and faiths, where the people are fighting for a cause greater than themselves.

I used to think that some historical figures dead because they are not smart enough to understand how bad are their decisions. Now, I think these people probably know that deep down in their subconscious minds. But they lack the self-control.

In the future, when I am responsible for many lives. I pray (to myself and the God of War) that I have the strength to put my people before myself.

2019-04-07

Share this!