Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q2(a) The Lyons Dance Company uses the following database that stores data about ballet dancers, shows and companies. COMPANY(compID, compname, city, country) DANCER(dancerID, dname, birthyear,

Q2(a)

The Lyons Dance Company uses the following database that stores data about ballet dancers, shows and companies.

COMPANY(compID, compname, city, country)

DANCER(dancerID, dname, birthyear, country, annualincome)

SHOW(showID, title, choreographer, composer, year)

ROLE(dancerID, showID, role, compID)

The primary key for each relation is indicated by the attribute underlined. The tables contain the following information:

  • COMPANY stores data about dance companies. The attribute compID is a number while the attributes compname, city and country are all strings.
  • DANCER stores data about individual dancers. The attribute dancerID is a unique integer ID for each dancer. The attributes dname and country are strings, birthyear is an integer and annualincome can be a decimal point number.
  • SHOW stores data about ballet shows (dances). Each show has a unique integer showID, string attributes for the show title, choreographer and composer, and an integer year in which the show was created.
  • ROLE stores data about which dancers have been in which shows, the name of the role (part) they danced, and the company where they danced that part in that particular show. The dancerID, showID and compID are integers and the role is a string. A dancer may have danced multiple roles in the same show at the same company, or danced the same role in the same show for different companies. Several attributes in ROLE are foreign keys: dancerID references dancerID in DANCER, showID references showID in SHOW and compID references compID in COMPANY.

(a) i. Write a SQL query to retrieve the following requested information from the dance companys database:

Say each dancer contributes a commission 10% of their annual income to the company each year. List the dancer ID, name, annual income, and the commission the dancer has contributed to his or her company in the past 3 years.

(a) ii. Write a SQL query to retrieve the following requested information from the dance companys database:

Show the dancer ID, name and country for dancers who have performed in a show composed by 'Tchaikovsky' but not choreographed by 'Petipa'. Each dancer should only appear once in the output. List the results based on dancer name in descending order.

(a) iii. Write a SQL query to retrieve the following requested information from the dance companys database:

Show the dancer name and company name of the dancers who earn more than the average annual income for their country. Each dancer name and company name pair should appear only once in the output.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

How does factor analysis allow for data reduction?

Answered: 1 week ago

Question

according to gsis theory,what is threatened by ecologicsl

Answered: 1 week ago

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago