COMP2400 Relational Databases

Question

1.

The relational database moviedb has the following database schema:

Movie(title, production year, country, run time, major genre)

primary key : ftitle, production yearg

Person(id,  rst name, last name, year born)

primary key : fidg

Award(award name, institution, country)

primary key : faward nameg

Restriction Category(description, country)

primary key : fdescription, countryg

Director(id, title, production year)

primary key : ftitle, production yearg

foreign keys : [title, production year] Movie[title, production year] [id] Person[id] 

Writer(id, title, production year, credits)

primary key : fid, title, production yearg

foreign keys : [title, production year] Movie[title, production year] [id] Person[id]

Crew(id, title, production year, contribution)

primary key : fid, title, production yearg

foreign keys : [title, production year] Movie[title, production year] [id] Person[id]

Scene(title, production year, scene no, description) primary key : ftitle, production year, scene nog

foreign keys : [title, production year] Movie[title, production year]

Role(id, title, production year, description, credits) primary key : ftitle, production year, descriptiong

foreign keys : [title, production year] Movie[title, production year] [id] Person[id]

Restriction(title, production year, description, country)

primary key : ftitle, production year, description, countryg

foreign keys : [title, production year] Movie[title, production year]

[description, country] Restriction Category[description, country]

Appearance(title, production year, description, scene no)

primary key : ftitle, production year, description, scene nog

foreign keys : [title, production year, scene no] Scene[title, production year, scene no] [title, production year, description] Role[title, production year, description]

Movie Award(title, production year, award name, year of award,category, result) primary key : ftitle, production year, award name, year of award, categoryg foreign keys : [title, production year] Movie[title, production year]

[award name] Award[award name]

Crew Award(id, title, production year, award name, year of award, category, result) primary key : fid, title, production year, award name, year of award, categoryg foreign keys : [id, title, production year] Crew[id, title, production year]

[award name] Award[award name]

Director Award(title, production year, award name, year of award, category, result) primary key : ftitle, production year, award name, year of award, categoryg foreign keys : [title, production year] Director[title, production year]

 [award name] Award[award name]

Writer Award(id, title, production year, award name, year of award, category, result) primary key : fid, title, production year, award name, year of award, categoryg foreign keys : [id, title, production year] Writer[id, title, production year]

[award name] Award[award name]

Actor Award(title, production year, description, award name, year of award,category,result) primary key : ftitle, production year, description, award name, year of award, categoryg foreign keys : [award name] Award[award name]

[title,production year,description]  Role[title,production year,description]

There are ve di erent categories of awards: movie awards, crew awards, director awards, writer awards and actor awards. A movie can only win an award after being nominated for the award.

Your task is to answer the following questions using SQL queries. For each question, your answer must be a single SQL query that may contain subqueries, and you must write and save your queries into the template le myqueries.sql.

1.1 Which awards are there in USA? List these award names.

1.2 Which comedy movies (i.e., the major genre of the movie is comedy) were produced in 1994? List their titles.

1.3 Who played at least one role in movies produced in 1995? List their ids,  rst and last names.

1.4 How many directors have directed at least one movie written by themselves? List that number.

1.5 Which movies had the ‘PG’ restriction in at least two countries? List their titles, production years and the corresponding number of countries with the ‘PG’ restriction.

1.6 Who have written exactly two American movies (i.e., the production country is USA)? List their ids,  rst and last names. Order your results in the ascending order of their ids.

1.7 How many directors have never played any roles in movies directed by themselves? List that number.

1.8 Which crew member(s) worked on the greatest number of movies? List their id(s),  rst and last names.

1.9 Who received the greatest number of nominations for a writer award but never won? List their id(s). 

1.10 Find all the pairs of crew members who won a crew award at the same age. List the pairs of their ids. Note that the result should not contain duplicated pairs of ids, e.g., (id1, id2) and (id2, id1) are considered as duplicated pairs and your query should only produce one of them in the result. Hint: if Emily (born in 1960) won a crew award in 1995 and Tom (born in 1955) won a crew award in 1990, they are considered as a pair of crew members who won a crew award at the same age (=35).

StudyAcer
Calculate your paper price
Pages (550 words)
Approximate price: -
StudyAcer

Quality Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

StudyAcer

Qualified Writers

We have hired a team of professional writers experienced in academic and business writing. Most of them are native speakers and PhD holders able to take care of any assignment you need help with.

StudyAcer

Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account.

StudyAcer

Prompt Delivery

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. We will always strive to deliver on time.

StudyAcer

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text.

StudyAcer

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

StudyAcer

Place your order

Fill in the order form and provide all details of your assignment.

StudyAcer

Proceed with the payment

Choose the payment system that suits you most.

StudyAcer

Receive the final file

Once your paper is ready, we will email it to you.

Academic Writing Services

If you are looking for exceptional academic writing services, then you are in the right place. Studyacer offers customised academic assignments and academic papers for students at all levels.

StudyAcer StudyAcer

Essays

Essay Writing Help

Writing an essay can be a challenge. However, we know what every student needs. And we purpose to deliver. Here at StudyAcer, we do all we can to help with academic essays and assignments. We have a dedicated team of professional essay writers.

StudyAcer StudyAcer

Assignment

Assignment Help

We understand students need satisfactory results. Our cheap assignment writing service helps and never leaves any doubt. We always strive to ensure the ultimate and best results. It is our joy to offer a cheap reliable essay writing service.

StudyAcer StudyAcer

Term paper

Term Paper Help

Have you been asking yourself, where can get a pre written research papers for sale? Worry no more, the fact that you have a term paper that is due tonight and you haven’t touched it. At Study Acer it is our responsibility to get your paper on time.

StudyAcer StudyAcer

Dissertation

Dissertation Writing Service

Several master’s students seek professional help with their thesis.Students from different parts of the world experience different challenges. Dissertations have different stages and the challenges are different too. Do not struggle in silence, order now .