Ask PL-SQL Expert

Writing SQL statements.

1. For each movie category, show the number of movies in the database of that category, the total number (sum) of nominations (NOMS) and the average length of that type. Include only those categories for which there are more than 5 movies in the database (i.e. use having). List the output with the greatest number of movies shown first (i.e. the highest count).

2. List the names (first and last) of stars, who are also directors. Include the star's director number in the results. Please note: the director may not have starred in the movie he/she directed, but has been a star in at least one movie and directed as least one movie.

3. List the movies which have more than one director. Include the year, title, last and first name of directors. Sort the output by last name within title. (use subquery)

4. List the movie titles that won both best actor and best actress awards.

5. List the countries (name) where no star was born. (the country name should be listed only once).

6. List the last and first names of all directors who have directed only one movie.

Movies Database

The following is an explanation of the columns in the tables in the Movie Database.

DIRECTOR (DirNum, CntryID, DirBorn, DirDied, Sex, LastName, FirstName)
DirNum - a unique numeric identifier for each director.
CntryID - Code for the country of birth. (Foreign key referencing COUNTRY).
DirBorn -The director's date of birth (mm/dd/yyyy). Some dates are prior to 1900. Null if unknown.
DirDied - date of death if deceased, otherwise null.
Sex - Gender of the director (M or F).
LastName - Director's last name.
FirstName - Director's first name.
MOVIE (MvNum, MvTitle, MvYear, CatID, MPAA, Len, Noms, Awrds, WWGross, USGross,

NonUSGross, CntryID, DirNum, BestDir, BestPic, BestEdit, BestFor, BestWrite)
MvNum - a unique numeric identifier for each movie.
MvTitle - The official title of the movie
MvYear - Usually, the year of release in the U.S. For some foreign movies, the release date in the originating country may have been a year earlier.

CatID - a 3-character code for the category of the movie. This is a foreign key referencing the CATEGORY table which contains an explanation of a code.

MPAA - Designates the U.S. rating of the system: R, PG13, PG, etc. Only movies released since the late 1960's are rated: older ones are coded NR.

Len - An integer representing the movie's length in minutes of running time.
Noms - An integer representing the number of Academy Awards for which the movie was nominated.
Awrds - An integer for the number of Academy Awards actually won.
WWGross - The movie's worldwide gross, in thousands of dollars (as of 12/31/2004).
USGross - The movie's U.S. gross, in thousands of dollars (as of 12/31/2004).
CntryID - A 2- or 3-character code for the country which produced the movie. A foreign key referencing the COUNTRY table.
DirNum - A foreign key referencing the Director table.
BestDir - A W in this column means that the movie won the Oscar for Best Director for the year of release. An N indicates a nomination for the Oscar but it did not win.
BestPic - W for Best Picture Oscar; N for nominee.
BestEdit - W for the Oscar for best editing; N for nominee.
BestFor - W for the Oscar for best foreign movie; N for nominees.
BestWrite - W for best writing; N for nominees.
MOVDIR (MVNUM, DIRNUM)
(MVNUM, DIRNUM) - composite primary key
MVNUM - A foreign key referencing the Movie table
DIRNUM - A foreign key referencing the Director table.
STAR (StarNum, CntryID, StarBorn, StarDied, Sex, DeathCause, FirstName, LastName, BirthCity,

BirthState)

StarNum - A unique numeric identifier for a movie actor.

CntryID - A 2- or 3-character code for the country where the star was born. A foreign key referencing the COUNTRY table.
StarBorn - Date of birth of the star: mm/dd/yyyy. May be null.
StarDied - Date of death if deceased.
Sex - Gender of the star ( M or F).
DeathCause - If the actor is deceased, the cause of death is indicated here.
FirstName - Star's first name.
LastName - Star's last name.
BirthCity - City where the star was born; e.g. New York. If born in Canada, the province is also given: e.g. Montreal, Quebec.
BirthState - State where the star is born.
MOVSTAR ( MvNum, StarNum, BestM, BestF, SupM, SupF)
MvNum - part of the primary key; also a foreign key referencing MOVIE.
StarNum - part of the primary key; also a foreign key referencing STAR.
BestM - A W in this column indicates an Oscar for Best Male Actor for this star. N indicates a nomination for this award.
BestF - W for the Oscar for Best Female Actress; N for the nomination
SupM - W for the Oscar for Best Supporting Male Actor; N for nominees.
SupF - W for the Oscar for Best Supporting Female Actress; N for nominees.
CATEGORY ( CatId, CategoryDesc)
Catid - A 3-character code for the category of the movie.
CategoryDesc - description for the category code.
COUNTRY (CntryID, CountryName)
CntryID - A 2-or 3-characert code for the country.
CountryName - the name of the country.

PL-SQL, Programming

  • Category:- PL-SQL
  • Reference No.:- M92064936
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in PL-SQL

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 ...

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 ...

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 ...

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 ...

  • 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