1. The Harry Potter Universe
Database
Charles Harrill, Greg Eskridge and Alex Janousek
December 8, 2016
2. Table of Contents
Project Name & Project Cover Sheet.............................................. Cover Sheet
Introduction.......................................................................................................... 3
Business Rules and User Requirements............................................................. 6
Enhanced Entity Relation Diagram.................................................................... 8
Entity, Attribute and Relationship Definitions................................................ 14
Relational Schema 3rd Normal Form……….................................................. 23
SQL Script File……………………….……….................................................. 36
Describe and Select Statements…..….……….................................................. 70
Database Queries…..….………......................................................................... 84
Peer Evaluation…………………..….………................................................... 98
2
3. Harry Potter Universe Database
Introduction
When reading Harry Potter books or watching the movies, it is very difficult to keep track
of all the characters, spells and other magical items that appear throughout the series. The fans
of these books and movies would appreciate having an app or website optimized for quick
reference, when questions arise about specific characters or event details. A well-constructed
database is created because of this need to gather the plethora of information that anyone would
possibly want to know about the Harry Potter universe. With a central repository of shared data,
information is easily managed by a controlling agent which stores all information in a
standardized, convenient form. Not only does the database prevent data redundancy and improve
data sharing but it also improves data accessibility and responsiveness to continuously improve
data quality and sharing. This helps prevent the compromising of data integrity however, there
are still many other challenges to take into consideration when making the Harry Potter Universe
database.
The potential users of this database are people who want to learn more about not only
what they read in the books, but also what they saw in the movies. This database will help these
users to be able to get answers to the questions that they seek to know more about after reading
or watching. Since there is a great amount of information in the series, the database will provide
a concise and logical way to solve any potential gaps in knowledge. For example, a user may
desire more information on what potions a wizard created or what group a given wizard is
associated with. They also might like to know more about which books a character appears in
and they type of school and house they are linked to. In this way, the user saves time trying to
flip through books and fast-forward through movies trying to get their answers.
There is no quick way to add all of the Harry Potter data and metadata at once. SQL
script files or queries will have to be created to add all of these entities such as characters,
humans, creatures, wizards and related attributes along with the relationships between each
entity. Other limitations to the database include taking the time to find all of the specific
information needed to insert all of the data into tables accurately. Another challenge that will be
faced is deciding on whether information from the books are more important than the movies and
vice versa. For example, the books are more descriptive and detailed and the scenes may vary
between the book and the appropriate movie. Also, many characters are left out in the movies
such as Peeves, Professor Binns and Ludo Bagman. A great amount of Quidditch matches are
absent as well along with many small but important scenes that are crucial to the storyline.
Another example of this is that the movies also do not cover apparition tests, wandless magic or
describe what a squib is, even though Filch and Mrs. Figg are present in them. Many scenes are
altered as well in the movies that make the storyline slightly different. A perfect example of this
would be in Harry Potter and the Deathly Hallows Part 1 when Harry escapes the Dursleys and
3
4. instead of first going through a series of safe houses via portkey, he magically ends up at the
Weasley’s house.
Some of these problems have been solved by creating multiple attributes such as
Book_Appeared_In (multiple value) and Movie_Appeared_In (multiple value) to better collect
the character data accurately even with differences between the films and books. In order solve
the problem of characters not appearing in the movies that were in the books, there is an attribute
called Level_Of_Impact which designates a character’s importance as minor or major. This
attribute keeps the data accurate by using the assumption that the correlation of a character being
left out of a movie is because of their level of importance which will be reported as minor.
The motivation behind the Harry Potter Universe database comes from the extensive
knowledge of the many books and movies with the goal of wanting to help people find the
information they need in the quickest means possible, without having data inconsistencies. Since
the scope of the Harry Potter universe is so extensive, a database would be the easiest solution
which allows data organization and manipulation whenever it is needed. With exactly 772 unique
characters in this series and over 100 spells, developing a database to organize data from this
universe is crucial for ultimately creating an app or website to integrate with the database.
With the use of a database, information is stored in electronic records that can be
searched, retrieved, organized and manipulated in countless ways. Not only is the data easy to
access, it is extremely accurate as well. With a GUI in place, all Harry Potter fans that are able to
operate a computer or digital device can easily update and view any information in the database
to help them better understand the series.
The additional benefits of the Harry Potter Universe database include saving precious
time by retrieving single or multiple records in the matter of minutes, whether you are writing or
using a GUI to submit the queries. These queries will systematically update and manipulate the
data accordingly and return the information quickly. It will be much quicker than searching
blindly on google or by other methods. With the structure and flexibility of databases, it is
extremely easy to link many different sources of information together to help better analyze and
see important patterns within the data and metadata they may not normally notice. With the
scalability of databases, it is easy to upgrade from thousands to millions of entries. The amount
of information in the Harry Potter Universe database can be infinite.
With superior databases, comes larger costs. In order to first set up a database, there are
specific setup costs required and then future ongoing expenses for maintaining it. Maintenance
costs increase with the size and growth of the database such as enhanced security and the training
of people to be able to use its functionality and understand the system. It would not be beneficial
for Harry Potter fans to have access to records that are inaccurate or are coming from a rogue
hacker who believes it would be entertaining to destroy the hard work put into creating the
database. Even though database management systems provide easy access, organization and
analysis of data, without a feasible budget, it may not be the best solution if a small team is not
continually maintaining it after it is created.
4
5. The goal of the Harry Potter Universe database is to begin the initial work needed to
eventually create a fully functional implementation of the database management system. Once
created, new Harry Potter fans and veterans alike can access, add information, and eventually put
in requests to edit or remove inaccurate data. Even with the challenges that come with the
development of a well-structured database (and especially one created for retaining Harry Potter
data), it is still more beneficial to create it for the fans. The creation of the this database would
be very much appreciated by those who want a greater understanding of the depth of Harry
Potter.
5
6. Harry Potter Universe Database
Business Rules
The Harry Potter Universe contains many Characters. The common attributes of a Character are:
Character_Name (identifier), Language (multiple value), Level_of_Impact (“major” or “minor”),
Book_Appeared_In (multiple value), and Movie_Appeared_In (multiple value).
A Character may be a Human or a Creature. The unique attribute of Human is Profession. The
unique attribute of Creature is Species. Some Characters may be classified as both, and there are
a few other Characters in the Harry Potter Universe, who have other classifications, such as
ghosts, but with no unique attributes. A Character may be the parent of one or more other
Characters, and each Character has two parents. However, not all Characters’ parents are
mentioned in the Harry Potter Universe.
A Human may be classified as a Wizard or a Muggle. There are many humans in the Harry
Potter Universe who may be classified as both. The unique attributes of Wizard are:
Wand_Type, Patronus, and Familiar_Type. The unique attribute of Muggle is Citizenship. A
Wizard may be responsible for protecting several Wizards or several Muggles. A Wizard may
also own multiple Creatures.
Each Wizard who attended a School was assigned to a House within that School. The attributes
of House are: House_Name (identifier), Symbol, and Characteristic (multiple value). Other
Characters may also appear as “House Ghosts.” Each House also has one Wizard in charge of
the House.
Each House is belongs to only one wizarding School, and each School may contain more than
one House, however not all Houses are mentioned for all Schools in the Harry Potter Universe.
The attributes of School are: School_Name (identifier), Number_of_Houses, and Region. Other
Characters, aside from Wizards, may also appear on the grounds of a School. Wizards may also
be faculty members of a School.
Wizards may be affiliated with a Group. The attributes of Group are: Group_Name (identifier),
Purpose, and Ethical_Orientation. Each Group has a designated Wizard_Leader. A Group must
include multiple Wizards and a Wizard may be a member of more than one Group.
A Character may be able to cast many different Spells. The attributes of Spell are: Spell_Name
(identifier), Type, Result, and Method_of_Casting. The last time a specific Character casted a
specific spell will need to be noted as Chapter_of_Last_Casting. A Character may be able to
6
7. cast many different Spells. A Spell may have also been invented by only one Character or may
have no inventor mentioned in the Harry Potter Universe. A Character may have invented
multiple Spells.
Each Wizard is also capable of making Potions by using Potion Ingredients, which are listed in a
Potion Recipe. The attributes of Potion are: Potion_Name (identifier) and effect (multiple
value). A Wizard may not know how to make any Potions or may know how to make a number
of Potions. A Wizard may also be the inventor of a Potion, but not every Potion has a known
inventor. A Potion can be made by at least one Wizard.
The attributes of Potion Recipe are: Potion_Recipe_ID (surrogate identifier), Potion_Name, and
Ingredient_Name (multiple value). The Attributes of Potion Ingredient are:
Potion_Ingredient_Name (identifier) and Location_Found. A Potion has only one recipe. One
Potion may contain many Potion Ingredients, but a Potion Ingredient may be used in more than
one Potion.
Characters may have studied several key Texts, which are highlighted in the Harry Potter
Universe. The attributes of Text are: Text_Title (identifier), Author, Subject_Matter, and Style
(as in fiction, nonfiction, poetry, prose, etc…). A Character may study many Texts or may not
study and Texts at all. A Text may also have been enchanted by a Wizard or may not be
enchanted at all.
Throughout the Universe, all Characters may love to eat some Notable Foods. The attributes of
Notable Food are: Food_Name (identifier), Food_Enchantment, Food_Type, and
Where_to_Obtain (multiple value). Many Characters may eat many Notable Foods in the Harry
Potter Universe. It is important to note the Chapter_Last_Eaten to view the last time a Character
ate a Notable Food.
A Character may also possess Enchanted Items. The attributes of Enchanted Item are:
Item_Name (identifier), Item_Enchantment, and Item_Type. Throughout the books of the Harry
Potter Universe, several Characters may have possessed several Enchanted Items. It is
important to note the final owner of an Enchanted Item by recording the
Chapter_Last_Owned_By_Character.
7
14. Harry Potter Universe Database
Entity, Attribute and Relationship Definitions
Entity and Attribute Definitions
Entity: Character
Definition: A Character is any person, ghost, creature, or other living or dead being, who
was specifically mentioned by name in any of the Harry Potter books or movies.
Attribute: Character_Name (identifier)
Definition: Every Character has a unique name.
Attribute: Language (multiple value)
Definition: This is how a character communicates. A character may be
able to communicate with one or more languages.
Attribute: Level_of_Impact
Definition: Some characters are major characters, and some are minor
characters. Level_of_Impact is a way to designate character importance.
Attribute: Book_Appeared_In (multiple value)
Definition: The Harry Potter Universe consists of multiple books. This
attribute captures in which books a Character appeared.
Attribute: Movie_Appeared_In (multiple value)
Definition: The Harry Potter Universe consists of multiple movies. This
attribute captures in which movies a Character appeared.
Attribute: Character_Type (Human?, Creature?)
Definition: This is the sub-type discriminator for Character. It is partially
complete, and there may be overlapping between Human and Creature.
Entity: Human
Definition: A Human is any Character that is a person.
Attribute: Profession
Definition: Each Human Character has a profession in the book, whether
a student, a teacher, a banker or other profession.
Attribute: Human_Type
Definition: This is the sub-type discriminator for Human. It has total
completeness, and the sub-types of the Human super-type are disjoint. So,
this is a simple attribute instead of a composite attribute.
14
15. Entity: Creature
Definition: A Creature includes an animal, such as an owl or cat, or a mystical beast,
such as a giant or phoenix. Creatures are almost any non-human Character, aside from
certain plants, ghosts or spirits.
Attribute: Species
Definition: As stated above, there are many types of Creatures. The
Species attribute specifies the type of Creature (ie. Cat, Dog, Griffon,
Centaur, Phoenix, Giant, etc.)
Entity: Wizard
Definition: A Wizard is a Human who is able to perform magic. This may also include a
human who was born to Wizard parents but has no magical abilities.
Attribute: Wand_Type
Definition: Every wizard needs to use a wand in order to perform most
magical Spells. Each Wizard has a unique wand type,
Attribute: Patronus
Definition: When a Wizard casts the Spell, “Expecto Patronum,” the
result is a protective force, in the shape of an animal, known as a Patronus.
Many Wizards have a unique Patronus that embodies their character.
Attribute: Familiar_Type
Definition: Wizards have a special, often magical, connection with their
familiars. Familiars are somewhat like pets, but with a stronger mental
connection to their Wizards. A familiar may be a cat, toad, owl, phoenix,
snake or other Creature.
Entity: Muggle
Definition: A Muggle is a non-Wizard Human, who is unable to perform magic and who
was not born to Wizard parents.
Attribute: Citizenship
Definition: All Muggles are a citizen of some country. While Wizards
tend to exist only in the Wizarding world after they come of age, Muggles
exist in the “real” world.
15
16. Entity: House
Definition: On the very first day that a Wizard attends a School of Wizardry, the Wizard
is “sorted” into one of the school’s houses. These houses are sort of dormitories, where
all of the students work as a team and study together, and where students do the majority
of their socializing.
Attribute: House_Name (identifier)
Definition: Each House has a unique name.
Attribute: Symbol
Definition: A Symbol is a house logo or insignia. This is typically a
representation of an animal, such as a lion, a raven, a badger or a snake.
Attribute: Characteristic (multiple value)
Definition: Wizards are sorted into a particular house based on their
primary character traits. One house may include Wizards who are
primarily brave and honest, while another may include Wizards who are
mostly intelligence and crafty.
Entity: School
Definition: Every Wizard attended a School of Wizardry, beginning at age 11 (before
September 1). The School entity focuses solely on Schools of Wizardry, within the Harry
Potter Universe, and does not include Muggle schools.
Attribute: School_Name (identifier)
Definition: Every School of Wizardry has a unique name.
Attribute: Number_of_Houses
Definition: Each unique School of Wizardry may contain a unique
number of Houses in which students are sorted.
Attribute: Region
Definition: Though they exist in the Wizarding World, these Schools are
located in various regions of the Earth, including Great Britain, the Soviet
Bloc, or Southwestern Europe, among others.
Entity: Group
Definition: Some wizards are affiliated with various sub-groups throughout the Harry
Potter Universe. The Group Entity is designed to capture these Wizard affiliations.
Attribute: Group_Name (identifier)
Definition: Every Group has a unique name.
Attribute: Purpose
Definition: This explains why a Group exists, whether, for instance, its
purpose is to destroy something, to protect something or to govern.
Attribute: Ethical_Orientation
Definition: Some groups have an evil agenda, some have a benevolent
agenda, and some may be neutral.
16
17. Entity: Spell
Definition: A Character may be able to cast magical spells, aimed to achieve a desired
result through magical means. The Spell entity captures this magical ability that can be
performed by most Wizards and some Creatures.
Attribute: Spell_Name (identifier)
Definition: Every Spell has a unique name.
Attribute: Type
Definition: Some spells are designed to attack, some may be used to
defend or heal, and others may be used for a more utility function, such as
cooking or casting a light.
Attribute: Result
Definition: This attribute is designed to detail the end result of casting a
certain spell.
Attribute: Method_of_Casting
Definition: Each Spell has a unique way of being cast. An example may
be “with a wand - a swish and a flick.”
Entity: Potion
Definition: Another way that Wizards perform magic is to make special Potions, by
mixing various ingredients together in a specific way. This creates essentially a Wizard
form of medicine.
Attribute: Potion_Name (identifier)
Definition: Every Potion has a unique name.
Attribute: Effect (multiple value)
Definition: Potions may be aimed at created various results. One Potion
may be designed to heal broken bones, while another Potion’s Effect is to
“induce relaxation and unfiltered honesty.”
Entity: Potion Ingredient
Definition: A Potion Ingredient is used during the formulation of a magical Potion.
Attribute: Potion_Ingredient_Name (identifier)
Definition: Every Potion Ingredient has a unique name.
Attribute: Location_Found (multiple value)
Definition: Potion Ingredients may each be found in one place or in a
number of different places. These locations may include geographical
areas or may include the office of a Character.
17
18. Entity: Potion Recipe
Definition: Some Potions may share Potion Ingredients, however every Potion has one
and only one Potion Recipe, combining a specific list of ingredients.
Attribute: Potion Recipe ID (identifier)
Definition: This is a surrogate identifier, designed to make a Potion
Recipe search easier to complete, instead of creating a composite primary
key between Potion_Name and Ingredient_Name, since Ingredient_Name
is a multiple value attribute.
Attribute: Potion_Name
Definition: This is the identifier of Potion.
Attribute: Potion_Ingredient_Name (multiple value)
Definition: This is the identifier of Potion Ingredient, and is a multiple
value attribute, comprised of all ingredients used to make the Potion.
Entity: Text
Definition: Throughout the Harry Potter books and movies, a Character may have
interacted with a number of different in-universe texts, whether school textbooks,
journals, news sources or other types.
Attribute: Text_Title (identifier)
Definition: Every Text has a unique title.
Attribute: Author
Definition: Each Text has an Author, who created the text. Some texts
share the same Author.
Attribute: Subject_Matter
Definition: A Text may be a news piece, a history book, a science
textbook, a work of fiction, or have another reason for existing, which is
its Subject_Matter.
Attribute: Style
Definition: To further describe the text, this attribute details whether the
text is poetry, prose, instructional, a play, or another style.
18
19. Entity: Notable Food
Definition: Some Notable Foods in the Harry Potter Universe received special mention
on one or multiple occasions throughout the books or movies.
Attribute: Food_Name (identifier)
Definition: Every Notable Food has a unique name.
Attribute: Food_Enchantment
Definition: Each of the Notable Foods mentioned, may have a unique
enchantment, such as a Chocolate Frog being magically enchanted to
behave like a real fog.
Attribute: Food_Type
Definition: This allows more detail about the food, including whether the
food is sweet or savory, or whether it’s a solid or liquid.
Attribute: Where_to_Obtain (multiple value)
Definition: Characters came across these Notable Foods in various
locations or settings. This multiple value attribute allows for explanation
of these locations.
Entity: Enchanted Item
Definition: Aside from wands, Potions and Foods, a Character may have interacted with
various other magical Enchanted Items. If an item that could qualify as the Text entity
was magically enchanted, it will be stored as an Enchanted Item.
Attribute: Item_Name (identifier)
Definition: Every Enchanted Item has a unique name.
Attribute: Item_Enchantment
Definition: This attribute details the magical effect that has been placed
on the Enchanted Item, such as invisibility or immortality.
Attribute: Item_Type
Definition: The Item_Type attribute is designed to describe what type of
item has been enchanted, such as a cloak, stone or journal.
19
20. Relationship and Attribute-on-Relationship Definitions
Relationship: Character “is parent of” Character (M:M)
Definition: A character may have optional or more parents mentioned in the Harry Potter
Books. A Character also may be the parent of optional or many Characters.
Relationship: Spell “invented by” Character (1:M)
Definition: A spell may have optional or one Character cited as its inventor. A Character
may have invented optional or many Spells.
Relationship: Character “reads” Text (1:M)
Definition: A Character may have read optional or many Texts. A Text that is
mentioned in the Harry Potter Books is read by one and only one Character.
Relationship: Character “visits” School (1:M)
Definition: A Character may have visited optional or one School during the course of the
Harry Potter Books and Movies. A School has been visited by many Characters.
Relationship: Character “casts” Spell (M:M)
Definition: A Character may “cast” or perform optional or many Spells. A Spell may
have been casted by optional or many Characters.
Attribute-on-Relationship: Chapter_Last_Cast
Definition: This is the last time that a certain Character casted a certain Spell in the
Harry Potter books.
Relationship: Character “possesses” Enchanted Item (M:M)
Definition: A Character may have possessed optional or many Enchanted Items at some
point in the Harry Potter Universe. An Enchanted Item may have been possessed by
optional or many Characters.
Attribute-on-Relationship: Chapter_Last_Possessed_By
Definition: This is the last time that a certain Character possessed a certain item in the
Harry Potter books.
Relationship: Character “loves to eat” Notable Food (M:M)
Definition: A Character may have been mentioned as eating optional or many Notable
Foods. A Notable Food was eaten by one or many Characters.
Attribute-on-Relationship: Chapter_Last_Eaten_By
Definition: This is the last time that a certain Character was noted as eating a certain
Notable Food in the Harry Potter books.
Relationship: Wizard “enchants” Text (1:M)
Definition: A Wizard may have used magic to enchant optional or many Texts. A Text
may have been enchanted by optional or one Wizard.
Relationship: Wizard “protects” Muggle (M:M)
Definition: A Wizard may have protected optional or many Muggles during the course of
the Harry Potter Universe. A Muggle may have been protected by optional or many
Wizards.
20
21. Relationship: Wizard “owns” Creature (1:M)
Definition: A Wizard may have been mentioned as owning optional or many Creatures
in the Harry Potter Universe. A Creature may have been owned by optional or one
Wizard. “Owns” may include owning a pet, having a familiar, or being the master of a
Creature, such as an Elf.
Relationship: Wizard “makes” Potion (M:M)
Definition: A Wizard may have made optional or many potions in the Harry Potter
Universe. Every Potion that was mentioned in the books was made by one or more
Wizards.
Relationship: Wizard “assigned to” House (1:M)
Definition: A House contains one to many Wizards, but a Wizard belongs to one and
only one House.
Relationship: Wizard “invents” Potion. (1:M)
Definition: A Wizard may have invented optional or many Potions, but each Potion was
invented by one and only one Wizard.
Relationship: Wizard “protects” Wizard (M:M)
Definition: A Wizard may have been protected by optional or many Wizards, and a
Wizard may have protected optional or many Wizards.
Relationship: Wizard “affiliates with” Group (M:M)
Definition: A Wizard may have been a member of, or affiliated with, optional or many
Groups. A Group has many Wizards affiliated with it.
Relationship: Group “lead by” Wizard (1:M)
Definition: Each Group has one and only one Wizard leader. A Wizard may have lead
optional or many Groups.
Relationship: Wizard “is faculty” School (1:M)
Definition: Every Wizarding School has a faculty of many Wizards. But a Wizard is
faculty of optional or only one School.
Relationship: Wizard “in Charge of” House (1:1)
Definition: A House has one and only one Wizard in Charge of it. A Wizard may be in
charge of optional or one House.
Relationship: House “belongs to” School (1:M)
Definition: A House belongs to one and only one school. A School contains one or
many Houses.
Relationship: Character “belongs to” House (1:M)
Definition: There are a few non-Wizard Characters, such as ghosts or half-giants, who
also belonged to a House. In that case, a Character may belong to optional or one
Houses, and a House contains one or more Characters.
21
22. Relationship: Potion “has” Recipe (1:M)
Definition: There are more than one Potion in the Harry Potter Universe that have a
Potion Recipe mentioned. However, every Potion has one and only one Potion Recipe.
Relationship: Potion Recipe “contains” Potion Ingredient (M:M)
Definition: Each Potion Recipe contains at least one Potion Ingredient. Some Potion
Ingredients may be used in more than one Potion.
22