Question
Answer the following questions, both in relational algebra, and SQL. Relational algebra queries should match SQL. For SQL queries provide the query and the result
Answer the following questions, both in relational algebra, and SQL. Relational algebra queries should match SQL. For SQL queries provide the query and the result (if the result contains more than 10 rows, show only the first 10 and the total number).
1. Game of Thrones has been filmed in many countries. In this query you will find out in which ones. TV se- ries have the attr value equal to TV-series. List the country in which episodes of the the TV series with title Game of Thrones has been filmed. Hints: You need to relate productions to episodes using episodeof, and you will need to use locations for the countries where the episodes have been filmed. Episodes are productions, the table episodes links episodes with their parent production entry (episodeof).
| country |
|------------------------|
| Canada |
| Croatia |
| Iceland |
| Malta |
| Morocco |
| Northern Ireland |
| Spain |
| UK |
| USA |
2. List the title, year and rank of movies (productions where attr is null) directed by the person with last-name Hitchcock, firstname Alfred and that have more than 50,000 votes. Hint: use table ratings.
| title | year | rank |
|-----------------------------+--------+------|
| Rear Window | 1954 | 8.5 |
| Psycho | 1960 | 8.5 |
| North by Northwest | 1959 | 8.4 |
| Vertigo | 1958 | 8.4 |
| Rebecca | 1940 | 8.2 |
| Dial M for Murder | 1954 | 8.2 |
| Strangers on a Train | 1951 | 8.1 |
| Rope | 1948 | 8 |
| Notorious | 1946 | 8 |
| The Birds | 1963 | 7.7 |
3. One of the great pairs in movie history is Paul Newman (pid Newman, Paul (I)) and Robert Redford (pidRedford, Robert (I)). For every movie in which both acted, and their character does not include the string Himself (use a regular expression comparison) list the title of the movie, its year, its ratings rank (from relation ratings), Pauls character, and billing, and Roberts role, and billing. Result contains 3 tuples.
| title | year | rank | paulchar | paulbilling | robchar | robbilling |
|-------------------------------------------------------+--------+------+---------------------+---------------+---------------------------+-------------|
| Butch Cassidy and the Sundance Kid | 1969 | 8.1 | Butch Cassidy | 1 | The Sundance Kid | 2 |
| Mickybo and Me | 2004 | 7.3 | Butch Cassidy | | The Sundance Kid | |
| The Sting | 1973 | 8.3 | Henry Gondorff | 1 | Johnny Hooker | 2 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started