In this problem we will consider a movie database with

Assignment Help PL-SQL Programming
Reference no: EM13380073

In this problem, we will consider a movie database with three tables:

MovieDirector(title, director, year)

MovieCast(title, actor, salary)

MovieReview(title, reviewer, score)

All attributes are strings except year, salary, and score, which are integers.

A- Write the following queries in SQL. To save you some writing, you may use the abbreviated schema MD(T,D,Y), MC(T,A,S), and MR(T,R,S). Write your queries so that the final answers will never include duplicates, but add the keyword DISTINCT only in cases where duplicates would otherwise be produced.

(a) Using subqueries in WHERE, find the directors who have also acted. Sort their names alphabetically.

(b) Without using subqueries in WHERE, find the actors who have never directed.

(c) Find the titles of all movies in the 1960's starring both Dustin Hoffman and Anne Bancroft.

(d) Without using EXCEPT, find the actors who starred in every movie directed by Kurosawa.

(e) Using SQL aggregates, find the titles of the movies with at least two reviews.

(f) Same as (e), but use subqueries in WHERE instead of aggregates.

(g) Same as (e), but do not use subqueries in WHERE or aggregates.

(h) Using SQL aggregates, find the titles of the movies with exactly one review.

(i) Same as (h), but do not use aggregates.

(j) For each reviewer, find the average scores of all his/her reviews. However, do not list reviewers who have given out scores less than 1.

(k) Let's define the rating of a movie to be the average score given to this movie by reviewers.

     Find title, rating, and year of production for each movie. Movies with higher ratings should be listed first, and among the movies with the same rating, newer movies should be listed first.

(l) Let's define the rating of a director to be the average rating of all his/her movies. Find the names and ratings of all directors who have directed movies starring Al Pacino.

(m) Is the following a correct solution for (l)? Why?

SELECT director, AVG(score)

FROM MovieDirector d, MovieReview r

WHERE d.title IN (SELECT title FROM MovieCast WHERE actor = 'Al Pacino')

AND d.title = r.title;

(n) For each actor, find the total salary he/she earned each year during 1995-1999.

B. Consider the same movie database above. Write SQL data modification statements to complete the following tasks.

(a) If a movie spends a total of more than $10,000,000 on its cast, put in a review by its director with a score of 10.

(b) For each movie, remove one of its reviews with the highest score. If this movie has more than one reviews with the same highest score, remove only one of them. If this movie has only one review, do not remove the review.

Reference no: EM13380073

Questions Cloud

Need a research paper on what is the single most important : need a research paper on what is the single most important new technology that has affected digital forensics in the
Scenarionbsp stella changes banks following her troubles : scenarionbsp stella changes banks following her troubles with shb. at her new bank ultimate security trust ust rsa is
In this assignment you will write an essay on protein : in this assignment you will write an essay on protein requirements. begin by performing an internet search for high
One of the most difficult aspects of planning software : one of the most difficult aspects of planning software development is estimating the effort. often times we are asked
In this problem we will consider a movie database with : in this problem we will consider a movie database with three tablesmoviedirectortitle director yearmoviecasttitle actor
1- prove that any relation schema with two attributes is in : 1- prove that any relation schema with two attributes is in bcnf.nbsp2- ra b c is a relation in bcnf. a is one of the
Part-11 what is the difference between interactive : part-11. what is the difference between interactive processing and real-time processing? 2. suppose a time-sharing
Design implement and test an object-oriented java program : design implement and test an object-oriented java program for processing single-variable polynomials represented as
Part 11 how many cells can be in a computers main memory if : part 11. how many cells can be in a computers main memory if each cells address can be represented by two hexadecimal

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Create program to enter first and second number

Create a program that enters first and a second number. The first and second number that will be entered should be computed in halves, quarter, double, and square.

  What is the expected profit for one month

Investigate the profitability that would result if instead of baking 30 batches each morning, they bake 25, 30, 35, or 40 batches. Which would you recommend and why? (You should use Decision Table with Crystal Ball, or Scenario Manager if plain Ex..

  Database systems1 what is an sql injection attack explain

database systems1. what is an sql injection attack? explain how it works and what precautions must be taken to prevent

  Create a clustered index on the groupid column

Write the CREATE INDEX statements to create a clustered index on the GroupID column and a nonclustered index on the IndividuallD column of the GroupMembership table.

  Write down name of actors in ascending order

Write down actors (or actress, your choice, but not both) who have won at least two (2) Academy Awards for best actor/actress. Provide the actor name, movie title & year. Order the result by actor name."

  Implement the tables in oracles 11g relational database

Explain the security mechanisms available for a database and how the data will be protected.

  Creating sql script queries

Get the movie title for all movies that are comedy or horror, rename the output attribute name to be "Happily Scared"

  Display account number and balance for all customers

This assessment item is designed to test your understanding of arrays/arraylists, objects, classes, methods, sorting and searching.

  Sql script-creating the database and inserting data

Understanding the SQL script, creating the database and inserting data and display all product information for products that contain the string ‘saw' in their description.

  Produce a report showing an organization chart

Produce a report showing an organization chart for Mourgos's department. Print last names, salaries, and department IDs and create a report that shows the hierarchy of the managers for the employee Lorentz. Display his immediate manager first

  Pl-sql block to display last name and salary

Write a PL/SQL block that displays the last name and salary of the following people. Each of these can be done separately as PL/SQL, first to test and get the output lines then encapsulated.

  Draw an entity relationship model for galle face elephants

Using the Oracle Developer Data Modeler tool, draw an Entity Relationship Model for the Galle Face Elephants case study above. Explain any assumptions you have made.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd