Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create table moviesList ( movie_id integer, name varchar(1000), score integer ); create table castList ( movie_id integer, cast_id integer, cast_name varchar(1000) ); Using the tables

create table moviesList ( movie_id integer, name varchar(1000), score integer );

create table castList ( movie_id integer, cast_id integer, cast_name varchar(1000) );

Using the tables created above, create a view called pairs that lists pairs of actors who are in the same movies together. Each row in the table must be one pair of actors who appear in at least 2 movies together AND each of the movies has a score >= 80. The output should be (cast_id1, cast_id2, num_movies, avg_movie_score) and it should be sorted by avg_movie_scores. Self-Joins will be necessary to complete this problem. Exclude self pairs (i.e. cast_id1 == cast_id2), but keep symmetrical/mirror pairs (i.e. (A, B) and (B, A)).

Here are sample inserts to use. insert into moviesList values(111, "Frozen", 90); insert into moviesList values(222, "Cars", 10); insert into moviesList values(333, "Finding Nemo", 100); insert into moviesList values(444, "Toy Story", 20); insert into castList values(111, 1, "David"); insert into castList values(111, 2, "Sarah"); insert into castList values(111, 3, "Hunter"); insert into castList values(222, 4, "Jim"); insert into castList values(222, 5, "Brennan"); insert into castList values(222, 3, "Hunter"); insert into castList values(222, 2, "Sarah"); insert into castList values(333, 5, "David"); insert into castList values(333, 6, "Pat"); insert into castList values(333, 2, "Sarah"); insert into castList values(444, 7, "Kim"); insert into castList values(444, 8, "Jim"); insert into castList values(444, 3, "Hunter");

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago