Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: This homework is based on the following movie database. The table definitions are listed below. You dont need to run these code. CREATE TABLE

Instructions: This homework is based on the following movie database. The table definitions are listed below. You dont need to run these code. CREATE TABLE actor( id INTEGER NOT NULL, name VARCHAR2(100), CONSTRAINT actor_PK PRIMARY KEY (id)); CREATE TABLE movie( id INTEGER NOT NULL, title VARCHAR2(100), yr NUMBER(4,0), score NUMBER, votes INTEGER, director VARCHAR2(100), CONSTRAINT movie_PK PRIMARY KEY (id)); CREATE TABLE casting( movie_id INTEGER NOT NULL, actor_id INTEGER NOT NULL, ord INTEGER, CONSTRAINT casting_PK PRIMARY KEY (movie_id, actor_id), CONSTRAINT casting_FK1 FOREIGN KEY (movie_id) REFERENCES movie(id), CONSTRAINT casting_FK2 FOREIGN KEY (actor_id) REFERENCES actor(id)); In the casting table, ord refers to the order of an actor in a movies cast list (ord = 1 refers to the leading actor). In this database, actors include both male and female. In this homework, we simply use Actors to represent all the actors and actresses in the data. In the movie table, yr is the year in which the movie is released. score is the average rating of a movie between 0 and 10 (inclusive). votes is the total number of people who rated the movie. 2 The database is created in the instructors account (MS3200125). You should run the following commands in your SQL Developer to create a virtual copy of the database in your own account. Then, you may directly use the three tables from your account. create synonym movie for MS3200125.movie; create synonym actor for MS3200125.actor; create synonym casting for MS3200125.casting; To test if the above comments are correctly executed, you may run a simple query such as: SELECT COUNT(*) FROM movie; The correct output should be 9992. ----------------------------------------------------------------------------- Q8. (10 pts) Find the directors who have collaborated with more than 200 different actors. Show the names of these directors and the number of different actors they each have collaborated with. Sort the results based on the number of actors in descending order. Q9. (10 pts) Find the directors who have never directed any movie that were rated below 9.0 (score). List the names of these directors. Q10. (10 pts) Find all the movies whose titles begin with 'Star Trek'. Show the title, year, score, and the name of the leading actor of these movies. Sort the results by year in descending order. Remove any duplicate rows in the result.

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions