Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following relational schema Person(pid: integer PRIMARY KEY, name: string, age: integer, liftimeIncome: float); Movie(mid: integer PRIMARY KEY, title: string, budget: real, yearReleased: integer,

Given the following relational schema Person(pid: integer PRIMARY KEY, name: string, age: integer, liftimeIncome: float); Movie(mid: integer PRIMARY KEY, title: string, budget: real, yearReleased: integer, director: integer REFERENCES Person); appearsIn(pid: integer REFERENCES Person, mid: integer REFERENCES Movie, role: varchar(10), PRIMARY KEY(pid,mid)); -- role is either 'starring' or 'supporting' In the queries below, an "actor" is a person who has appeared in a movie; and a "director" is a person who was the director of a movie. Write the following queries in SQL (this time you may use aggregates, groupBy, etc.): a1. Find the pid of all known actors. a2. Find the pid of all known actors and directors. (This is NOT meant to to be people who were _both_ actors and directors.) b. Find the name and age of each actor who appeared in both a movie released in 1995 and one released in 2005. c. Find the name of each person whose lifetime income exceeds the budget of all of the movies that he or she appeared in. d. Find the name of each person(s) who directed the movie(s) with the largest budget. e. Find the id of each person who directed 3 or more movies and controlled the largest total amounts. (The director of a movie is said to control its budget.) 

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

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions

Question

Payment Card Industry Data Security Standard ( PCI DSS )

Answered: 1 week ago

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago