Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PART 2 (35 points - 5 points each question) Write the following queries in relational algebra, using the schema provided for the MOVIES database. ACTOR

image text in transcribed

image text in transcribed

image text in transcribed

PART 2 (35 points - 5 points each question) Write the following queries in relational algebra, using the schema provided for the MOVIES database. ACTOR (actor_id, first_name, last_name, last_update) LANGUAGE (language_id, name, last_update) CATEGORY (category_id, name, last_update) FILM (film_id, title, description, release_year, language_id, length, rating, last_update) FILM_ACTOR(actor_id, film_id, last_update) FILM_CATEGORY (film_id, category_id, last_update) COMMENTS (review_id, film_id, reviewer_name, comment, score, last_update) To write these queries it is strongly recommended to 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). Note: In the assignment page in Canvas, it is attached a document (movie_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 right 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. 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 ID's change. That means don't use directly specific ID's in the query (THAT WILL DISCOUNT 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 Movie Title", we don't know a priori the ID of that movie, we will need to write the query in a way that is able to use the movie title, and not 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. Note: It is possible to write the queries without using relax, of course, but then you won't be able to check the results of the queries. In that case you can use abbreviations for Relational Algebra symbols such as S for SELECTION, P for PROJECTION, * for NATURAL JOIN, - for SET DIFFERENCE 6. Find all the movie titles where and actor called "TOM" OR an actor called "BEN" acted, where there was another actor called "MARY" acting too. (That means movies with TOM and MARY, movies with BEN and MARY and movies with TOM, BEN and MARY) 7. Find the reviewers that have reviewed movies in all the categories. PART 2 (35 points - 5 points each question) Write the following queries in relational algebra, using the schema provided for the MOVIES database. ACTOR (actor_id, first_name, last_name, last_update) LANGUAGE (language_id, name, last_update) CATEGORY (category_id, name, last_update) FILM (film_id, title, description, release_year, language_id, length, rating, last_update) FILM_ACTOR(actor_id, film_id, last_update) FILM_CATEGORY (film_id, category_id, last_update) COMMENTS (review_id, film_id, reviewer_name, comment, score, last_update) To write these queries it is strongly recommended to 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). Note: In the assignment page in Canvas, it is attached a document (movie_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 right 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. 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 ID's change. That means don't use directly specific ID's in the query (THAT WILL DISCOUNT 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 Movie Title", we don't know a priori the ID of that movie, we will need to write the query in a way that is able to use the movie title, and not 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. Note: It is possible to write the queries without using relax, of course, but then you won't be able to check the results of the queries. In that case you can use abbreviations for Relational Algebra symbols such as S for SELECTION, P for PROJECTION, * for NATURAL JOIN, - for SET DIFFERENCE 6. Find all the movie titles where and actor called "TOM" OR an actor called "BEN" acted, where there was another actor called "MARY" acting too. (That means movies with TOM and MARY, movies with BEN and MARY and movies with TOM, BEN and MARY) 7. Find the reviewers that have reviewed movies in all the categories

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions