Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose a database has the following three relations. Movie (mid: integer, title: string, director: string, releaseDate: date) PlaysAt (theaterID: integer, movieId: integer, showDate: date) Theater

Suppose a database has the following three relations. Movie (mid: integer, title: string, director: string, releaseDate: date) PlaysAt (theaterID: integer, movieId: integer, showDate: date) Theater (tID: integer, name: string, phone: string, screencount: integer) "movieID" in PlaysAt is a foreign key referencing "mid" in Movie. "theaterID" in PLaysAt is a foreign key referencing "tID" in Theater.

Write the following queries in both relational algebra and SQL.

  1. Find the titles of movies playing on 2 / 26 / 2019 and the IDs of the theaters they are playing at. (You may assume that a simple "=" works on the date data type.)
  2. Find the names of theaters that are playing a movie titled "Pride and Prejudice" and a movie titled "Sense and Sensibility."
  3. Find the phone numbers of theaters where the movie titled "The Green Book" is playing on 3 / 2 / 2019.

Write the following queries in SQL only.

  1. Find the titles and movie IDs of movies whose titles start with "Ha" and end with "en".
  2. For each movieID, find the number of different theaters that are playing the movie on 2 / 26 / 2019. (List both movieIDs and counts of theaters in output.)
  3. List all movieIDs and movie titles. If the movie is playing in a movie theater, also list the theater's ID and the show date.
  4. For each theaterID, find the number of different movies that are playing at that theater on 11 / 9 / 2018. The user is only interested in information about theaters that are playing more than three movies on 11 / 9. (List both theater IDs and counts of movies in 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_2

Step: 3

blur-text-image_3

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

Conduct a needs assessment. page 269

Answered: 1 week ago