Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask PL-SQL Expert

Problem I:
1- Prove that any relation schema with two attributes is in BCNF.
2- R(A, B, C) is a relation in BCNF. A is one of the keys of R. R may have other keys.
Prove that R is in 4NF.

(Hint: Assume that R is not in 4NF. What could the MDs that violate 4NF be?

For each such MD, use what you know about the relation to show that this MD cannot violate 4NF.)

3- Consider the universal relation R = {A, B, C, D, E, F, G, H, I} and the set of functional dependencies
F = { {A, B} -> {C}, {A} -> {D, E}, {B} -> {F}, {F} ->{G, H}, {D} -> {I, J} }.

What is the key for R? Decompose R into 2NF, then 3NF relations.


Problem II:

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.

PL-SQL, Programming

  • Category:- PL-SQL
  • Reference No.:- M9892622
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question?


Related Questions in PL-SQL

Purpose of the assessment with ulo mapping the purpose of

Purpose of the assessment (with ULO Mapping) The purpose of this assignment is to develop skills in managing data in databases and to gain understanding of data model development and implementation using a commercially a ...

For this assignment you will be provided a database backup

For this assignment, you will be provided a database backup for a database called FinanceDB. You will have to restore this backup to your own version of SQL Server. All of the questions in this assignment relate to the F ...

Assignment - queries functions and triggersaimthe aims of

Assignment - Queries, Functions and Triggers Aim The aims of this assignment are to: formulate SQL queries; populate an RDBMS with a real dataset, and analyse the data; design test data for testing SQL queries; create SQ ...

Complete the following tasksin microsoft access create the

Complete the following tasks: In Microsoft Access, create the database and tables that you identified in W3 Assignment 2. In Microsoft Word, write the SQL statements to create the database and tables. Write SQL statement ...

Continuing the project you have worked on in weeks 1-4 in

Continuing the project you have worked on in Weeks 1-4, in this final week, complete the following tasks: Refine your database and SQL statements by incorporating your instructor's feedback. Verify that the database comp ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As