What could the mds that violate 4nf be

Assignment Help PL-SQL Programming
Reference no: EM13313310

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.

Reference no: EM13313310

Questions Cloud

Explain what''s the compound structure : Does (CH3CH2)2C=CHCH2CH3 have any cis/trans isomers and if so what are they? Also what's the compound structure?
Marketing business-to-business : Marketing business-to-business
Determine the nominal flextural strength of the section : a rectangular beam with a width of a 8 in. an effective depth of 10 in., and a total depth of 12 in., is reinforced with a single fiberglass reinforcing bar that has a cross sectional area of 0.45 in^2.
Assignment for bmw : Assignment for bmw
What could the mds that violate 4nf be : 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.
Determine what is the coefficient of permeability : An aquifer is 45 meters deep and has a well that pumps water at 850 cubic meters per day. One observation well is located 45 meters away and has a water surface that is 44.35 meters above the bottom of the aquifer.
Explain what is the ph of 0.191 mol/l ch3cooh(aq) : Acetic acid, CH3COOH, is a weak monoprotic acid (pKa=4.74 at 25oC). What is the pH of 0.191 mol/L CH3COOH(aq) at 25oC
What is the concentration of bod remaining after 3 days : A 20 cubic meter tank contains ultimate BOD at a concentration of 550 mg/L. If the BOD reaction rate constant is -0.42/day, what is the concentration of BOD remaining after 3 days
Testing to assess the worth of a new windows program : Testing to assess the worth of a new Windows program

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Describe the meaning of keyword exists and not exists

Describe the meaning of the keyword EXISTS. Describe how any and all relate to EXISTS and NOT EXISTS. Write a query which will display names of any customers who are interested in all artists.

  An er diagram for the system

An ER diagram for the system. Show all entities, relationships, cardinalities and optionalities. Also, include all intersection entities. You must use the Finkelstein methodology as per the study book and tutorials.

  Create a pl-sql block using the hr schema

Create a PL/SQL block to achieve the following using the HR schema and select the name, salary, and department of the employee with the maximum salary.

  Select statement to return one row

Write a SELECT statement that returns one row for each general ledger account number which contains three columns.

  Relational schema of a firm database - write a sql query

Display the vendor ID and vendor name of the items whose item quantity is the largest and display the item ID and item quantity of all items whoseitem quantity is less than the average quantity. Also display the average quantity

  You have been asked to design a data model

Law Associates is a large legal practice based in Sydney. You have been asked to design a data model for the practice based upon the following specification

  Indicate the changes

Indicate the changes (using the shorthand representation) that you would need to make to the original Premiere Products database design to support the following requirements. There is no relationship between customers and sales reps.  When a custo..

  Script that creates and calls a function named

Write a script that creates and calls a function named fnDiscountPrice that calculates the discount price of an item in the OrderItems table (discount amount subtracted from item price). To do that, this function should accept one parameter for th..

  Query to show customers were missing for existing orders

As DBA, your manager called a meeting and asked why there are so many orders for customers that don't exist in the customer table. Write query which would shows which customers were missing for existing orders. Use a join or a subquery.

  Display all the lastnames from the customers table

Display all the LastNames from the Customers table and any associated OrdersIDs from the Orders Table. Show the LastName even if they do not have any associated orders. Order the results by LastName in ascending order.

  Write pl-sql block which displays last name

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

  Write a iterative function that returns the summation

Write and test functions that return summation of all the numbers (items) in the list. Write a recursive function that returns the summation of all the numbers in the list.

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