Assume a database with schema ACTOR(name, age, address, nationality) MOVIE(title, year, genre, budget, director-name, studio) APPEARS(name, title, salary) where the table ACTOR contains information about actors and actresses, and name is the primary key; MOVIE contains information about movies (their title, the year they were made, their budget, the name of the person who directed the movie and the studio who produced it) and title is the primary key.¹ Attribute genre is one of 'action', 'comedy', 'drama', 'sci-fi', 'horror' and so on. APPEARS tells us which actor

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter2: Database Design Fundamentals
Section: Chapter Questions
Problem 11RQ
icon
Related questions
Question

SQL:

Assume a database with schema
ACTOR (name, age, address, nationality)
MOVIE (title, year, genre, budget, director-name, studio)
APPEARS(name,
title, salary)
where the table ACTOR contains information about actors and actresses, and name is the primary key;
MOVIE contains information about movies (their title, the year they were made, their budget, the name of
the person who directed the movie and the studio who produced it) and title is the primary key.¹ Attribute
genre is one of 'action', 'comedy', 'drama', 'sci-fi', 'horror' and so on. APPEARS tells us which actor
appeared in which movie (so name and title are foreign keys in APPEARS), and how much s/he was paid
for acting in the movie. Note that an actor may have appeared in several movies, and a movie may have
several actors appearing on it; the key of APPEARS is (name, title).
Write the following questions in SQL:
1. List the titles and budgets of movies where actor Keanu Reeves appeared in 1999.
2. List the names and ages of actors who have appeared in a comedy produced by Studio 'MGM'.
3. List the names of directors who have directed a drama or a comedy.
4. List the names of directors who have directed a drama and a comedy.
5. List pairs of actors who have appeared together in a movie (note: the schema of your answer should
be (name1, name2), where both name1 and name2 are names of actors.
Transcribed Image Text:Assume a database with schema ACTOR (name, age, address, nationality) MOVIE (title, year, genre, budget, director-name, studio) APPEARS(name, title, salary) where the table ACTOR contains information about actors and actresses, and name is the primary key; MOVIE contains information about movies (their title, the year they were made, their budget, the name of the person who directed the movie and the studio who produced it) and title is the primary key.¹ Attribute genre is one of 'action', 'comedy', 'drama', 'sci-fi', 'horror' and so on. APPEARS tells us which actor appeared in which movie (so name and title are foreign keys in APPEARS), and how much s/he was paid for acting in the movie. Note that an actor may have appeared in several movies, and a movie may have several actors appearing on it; the key of APPEARS is (name, title). Write the following questions in SQL: 1. List the titles and budgets of movies where actor Keanu Reeves appeared in 1999. 2. List the names and ages of actors who have appeared in a comedy produced by Studio 'MGM'. 3. List the names of directors who have directed a drama or a comedy. 4. List the names of directors who have directed a drama and a comedy. 5. List pairs of actors who have appeared together in a movie (note: the schema of your answer should be (name1, name2), where both name1 and name2 are names of actors.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Transaction Processing
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781305971776
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning