Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the following 6 queries in relational algebra, using this schema provided for the Superheros database. superpower id power_name superhero id superhero_name full_name gender_id (FK

Write the following 6 queries in relational algebra, using this schema provided for the Superheros database. superpower id power_name superhero id superhero_name full_name gender_id (FK to gender.id) eye_colour_id (FK to colour.id) hair_colour_id (FK to colour.id) skin_colour_id (FK to colour.id) race_id (FK to race.id) publisher_id (FK to publisher.id) alignment_id (FK to alignment.id) height_cm weight_kg race id race publisher id publisher_name attribute id attribute_name alignment id alignment colour id colour gender id gender hero_attribute hero_id (FK to superhero.id) attribute_id (FK to attribute.id) attribute_value hero_power hero_id (FK to superhero.id) power_id (FK to superpower.id) 1. (3p) Find the name and height and weight from all the superheroes higher than 500 cm but they must have a weight lower than 5000 kg (or the weight info should be null): EXPECTED RESULTS: 2. (4p) Find the name of all the superheroes with the power 'DimensionalAwareness' EXPECTED RESULTS: 3. (7p) Find the superhero name and full name of all the heroes that have 100 points in Intelligence but less than 15 in Strength. EXPECTED RESULTS: 4. (7p) Find the publishers with human superheroes (race) but without any alien superhero (race) EXPECTED RESULTS: 5. (7p) Retrieve the id and name of all the superheroes that have blue eyes and alignment neutral and intelligence under 90 at the same time OR all the superheroes that have red eyes and alignment bad and strength more than 90 at the same time. EXPECTED RESULTS: 6. (7p) Find the publisher names for the publishers with at least one superheroe on each of the possible genders EXPECTED RESULTS: To write these queries you MUST use RelAx (view the document in Canvas about how to use it). The query (set of queries) generated in Relax can be copied and pasted as a solution (in fact that is what is expected) in a txt document. (No PDF or WORD). Queries that cant be copied from your solution and pasted in RelAx wont be graded. Note: In the assignment page in Canvas, it is attached a document (superheros_relax.txt) with the test data to load in relax, and another document (expected_results.txt) with what is expected to have as a result on each of the queries. In that way, you can test your own query to check if it is correct or not, and if not, review it until you find the right solution. NOTE: The correct solution must return what is asked, not just match with the expected result in the file. It needs to work as expected for any possible data and not only for the test data. If more data is added, it must still return the right answer including the new data. A wrong query could, maybe, return the same correct result with the test data, but still be incorrect for other data so be careful about that. Your queries must not be state-dependent", that is, they should work without modification even if another instance of the database is given or if the IDs change. That means don't use directly specific ID's in the query (THAT WILL DISCOUNT 2 POINTS), the query will need to find the ID's based in the data provided. For example: If the data provided in the question is the Superhero Name, we don't know a priori the ID of that superhero, we will need to write the query in a way that is able to use the superhero name, and NEVER directly the ID. NOTE: THIS IS NOT MYSQL, this is RELATIONAL ALGEBRA. Any answer provided in Mysql will be graded with a 0. If a query is long, it is recommended to break it up into a series of queries with intermediate answers stored in temporary relations.

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

Recommended Textbook for

Building The Data Lakehouse

Authors: Bill Inmon ,Mary Levins ,Ranjeet Srivastava

1st Edition

1634629663, 978-1634629669

More Books

Students also viewed these Databases questions

Question

Using the Behavioral Checklist, what is Stuart lacking in EI?

Answered: 1 week ago