Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We don't actually need them to do this. Just SQL commands that would appropriately filter to what is specified. Unfortunately i cannot upload files here.
We don't actually need them to do this. Just SQL commands that would appropriately filter to what is specified. Unfortunately i cannot upload files here.
Instructions: For this assignment you must submit a text document (with txt extension) with the sql answers to the following questions. Consider the MOVIES relational database schema description: A movie can have 0 or more actors A movie can have 1 or more categories A movie has 1 and only one language Rating is one of these values: 'G','PG','PG-13','R','NC-17' People can comment about the movies in a webpage, and the comments are stored in the comments table. The reviewer_name is introduced by the person on each comment, so we don't have a table with reviewers. A reviewer can create any number of comments about a movie The comments will have a score about the movie with values from 0 to 100. Note, the last_update fields are going to be stored as a "timestamp". IMPORTANT: 2 entries in the same relation can have the same last_update, so, for example, 2 movies can have the same last_update value. The relations are: 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) 2. (40 points) Write the following queries in MYSQL, using the schema provided above. The queries will need to work on MySQL and return the expected results with the provided data set. This will make it easier for you because you can test the queries and see if they work or fail. The query (set of queries) tested on Mysql can be copied and pasted as a solution (in fact that is what is expected) in a text file. We will test your queries (copy-paste) in a real environment to check if they work or not. Note: In the assignment page in Canvas, it is attached a document (movie_mysql.sql) with the test data to load in mysql/sqlfiddle, and another document (expected_results.zip) with contains a file with the expected result for 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, the query will need to find the ID's based in the data provided. For example: If the data 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 SQL, NOT RELATIONAL ALGEBRA. Any answer provided in RELATIONAL ALGEBRA will be graded with a 0. 3. (5 points) Find the last name from all the actors with first name "KIRK that act in movies with at least a comment from "Mando88" and at the same time without comments from James82" 4. (5 points) Retrieve the title of all the Movies in the 'Sports' category, rated R and without actors with a last name bigger or equal than TORN (alphabetically) order by film id in descending order. 5. (5 points) Find all the movie titles with actors called BOB OR actors called "JOHN" and, at the same time, with comments from "Mando88 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started