Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can Somone help me with the following questions, Thank you. Question 2 As a budding computer scientist, you have noticed that many of your fellow

Can Somone help me with the following questions, Thank you.

Question 2

As a budding computer scientist, you have noticed that many of your fellow students are somewhat obsessed with science fiction, especially Star Wars. Since you are a budding computer scientist, you are also naturally interested in these things. However, the proliferation of movies, books, TV shows, etc, is making it increasingly difficult to keep up with all the different Star Wars concepts (and thus, to take part in conversations pertaining to said concepts). For this reason, you have decided that it is time to create a Star Wars database to help you keep track of everything. You have ascertained that the following information would be the most useful to you at the current time: Information on characters: common name, alias, and gender. Some characters have an alias which is another name by which that character is sometimes known (for example, to give away a plot point, Anakin Skywalker has the alias Darth Vader). You have noticed that no 2 characters share the same name. You have also noticed that no 2 characters share the same alias, and that some characters are neither male nor female. Some characters are droids, in which case you need to keep track of their type. Some characters are Jedi/Sith (yes, you have noticed that there are enough similarities between Jedi and Sith that they really only belong to a single category). Characters in this category have a level (knight, master, etc). Characters may hold position(s) in political units. Political units have a name and type (government, military, or independent), and obviously have at least 1 character holding some position. Jedi/Sith characters may participate in a mentorship relationship, in which one character is the apprentice and the other is the mentor. You wish to keep track of the starting year and final year in which this mentorship occurred (only a single mentorship can occur between any apprentice/mentor pair). The mentorship may be approved by a political unit. There are many planets in the Star Wars universe. Each planet has a name and a location (specified by a combination of x, y and z coordinates in space). Every character has a home planet. Every battle is associated with a planet. Battles have a name and year. You also wish to keep track of the political unit considered the winner of the battle. Vehicles have a name (e.g. Raddus) and type (e.g. star destroyer, battlestation, landspeeder etc.). You wish to keep track of which vehicles are used in which battles, and which characters use which vehicles. Weapons have a type and colour. You wish to keep track of which characters use which weapons (including the colour of the weapon they use, as this appears to be important). Draw an ER diagram for the database. All attributes of each entity set and relationship set must be shown. All key and participation constraints must be shown for each relationship set. In addition, write a paragraph specifying any necessary overlap and covering constraints.

Question 3

Translate your ER diagram from question 2 above into a relational schema, and write the SQL statements to create the relations, capturing as many constraints (including key and foreign key constraints) as possible. Explain the constraints that you have captured, and if there are constraints that you could not capture, then explain why they could not be captured.

Question 4

Consider the relations you defined in Question 3 above. a) [4 marks] Write SQL statement(s) to add the following character: R2-D2, an astromech droid. b) [4 marks] Write SQL statement(s) to change the level of all Jedi/Sith characters at level padawan to knight. c) [6 marks] Write SQL statement(s) to delete the planet named Alderaan. Given the referential integrity constraints chosen, explain what happens when this statement is executed, and why. Might any further deletions be necessary to ensure all of the constraints in the ER diagram (even those not captured in your tables) are enforced?

Question 5

Given the relations you defined in Question 3 above, express each of the following queries in SQL: a) Find the names of the characters who were mentors to Anakin Skywalker. b) Find the names of all vehicles that are battle stations. c) Find the coordinates of the planet named Ahch-To. d) Find the names of political units that have approved at least one mentorship.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions