Relational Algebra: Aggregation

Similar documents
CSC 343 Inverted course material: SQL subqueries

Regent Student Film Showcase Submission Manual Contact: Phone:

IL NOSTRO CINEMA A BORDO OUR ON BOARD CINEMA

Recommendations Worth a Million

adult paperback spoken word audio

The Sean Wyatt Thriller Box Set: A Suspense Action Fiction Thriller Collection (Sean Wyatt Mystery Thrillers Book 4) By Ernest Dempsey READ ONLINE

Recommended by... Title Author Genre / Focus Level of difficulty - 1 easy to 5 challenging

Film Genre Introduction

Horror, Science Fiction, And Fantasy Movie Posters (Horror, Sci-Fi & Fantasy Movie Posters)

Die Chemie in Spielfilmen, Cartoons und Kinderzeichnungen

Movie Genres. Movie Genres Definition Examples Chinese 1. Action. 2. Adventure. 3. Comedy. 4. Drama. 5. Crime. 6. Horror. 7. Fantasy. 8.

MARCH RETAIL ORDER FORM

Understanding Genre An approach to popular film

THE AMERICAN FILM INSTITUTE CROWNS TOP 10 FILMS IN 10 CLASSIC GENRES

The German Amazon Kindle Category Cheat Sheet

Southbound: A Dystopian Science Fiction Thriller By Erik Boman READ ONLINE

1. Let me introduce myself.

An Introduction to the Graphic Novel

ACTION ADVENTURE COMEDY CRIME & GANGSTER DRAMA EPICS & HISTORICAL HORROR MUSICAL SCIENCE FICTION WAR WESTERNS

On-line Digital Campaign Latam

Nightwings: A Graphic Adaptation (Science Fiction Graphic Novel) By Cary Bates, Robert Silverberg

LC Genre/Form Terms for Library and Archival Materials

Dracula Rising By Jackson Stein

Overtaken: An Alien Romance Story (Sci Fi Alien Romance) (Volume 1) By T.J. Brandow READ ONLINE

Graphiti: Interactive Specification of Attribute-based Edges for Network Modeling and Visualization

Genres and Subgenres. Classifying literature

Genres and Subgenres. Classifying literature

Jaws (1975) directed by Steven Spielberg

MIPCOM 2017 Market Snapshot: North America. Top SVOD titles and genre trends: Demand share and YoY growth

Now that you have achieved your Bronze Award, where you could pick any book you wanted, it s time to broaden your horizons!

Spirited Away and Ju-On: The Grudge

APPLICATION FORM. 1: Personal details. 2: Statement of eligibility. Title. Name. Address. Postcode male female / / Date of Birth.

the GREAT ESCAPE COPING WITH THE GREAT DEPRESSION

Caroline Schaumann German Studies Course: Screening Nature August 2010

There are types of fiction?

An Introduction to Film: How to become a Hollywood Film Critic. Writing 12: Media Analysis Unit Craig Ketchum & Stacy Sowerby

Science Fiction Stars And Horror Heroes: Interviews With Actors, Directors, Producers And Writers Of The... By John Brunas and Michael Brunas

DOWNLOAD OR READ : THE THRILLER THEATER PDF EBOOK EPUB MOBI

The Stephen Spielberg Story: The First Stephen Spielberg Comic Biogrhaphy (Great Hero Series) By T.S. Lee

Science fiction, fantasy and horror MPU 3362 (2 credits) MPU Semester/ Semester /2018. Module Guide

Item: Individually Numbered Limited Edition Autographed Bruce Springsteen & The E Street Band "Born In The USA" Record Album Display

Digital and Non-Digital Media. Media 8 and 9

"PLAY IT AGAIN, SAM" The current Films for BSV theme is: Originals vs. Remakes. Version Title Category DVD Blu-ray Recommended

Man-made Horrors (World Of Horror) By John Hamilton

The Atomic Sea: Part Six: Wrath Of The Deep: An Epic Fantasy / Science Fiction Adventure Series By Jack Conner READ ONLINE

Conflict Classifications of Literature. revised: English 1302: Composition & Rhetoric II D. Glen Smith, instructor

Batman & Robin: Dark Knight Vs. White Knight By Various

The Killing Hour: A Thriller By Paul Cleave

Purenet: The Sanction Scifi Series (The Sanction Thriller Series) (Volume 1) By HJ Lawson

Spring Course Descriptions for ENGLISH 1050 THE LITERARY EXPERIENCE All sections are writing intensive

''WAR AND PEACE'' IN STUDIO GHIBLI FILMS: DIRECTOR HAYAO MIYAZAKI'S MESSAGES FOR WORLD PEACE BY DAISUKE AKIMOTO

MODERN FANTASY WITH JASMIN A. AND HANNAH R.

The Year In Demand. An Exclusive White Paper. for Members of the International Academy of Television Arts & Sciences

Comics Creators On Spider-Man By Tom DeFalco

VV 301 FILM STUDIES GENRE. Prepared by: WAN FARHANAH BINTI WAN ISMAIL (PTSS,2012)

EMERGING WRITERS FELLOWSHIP FAQ

Spy Killer (Mystery & Suspense Short Stories Collect) By L. Ron Hubbard READ ONLINE

Requirements. To be Completed prior to museum visit:

'My Story Can Beat Up Your Story!' & 'TotallyWrite' Jeffrey Alan Schechter, Unauthorized use and/or duplication of this material without

EMERGING WRITERS FELLOWSHIP FAQ

Do Androids Dream Of Electric Sheep? (S.F. MASTERWORKS) By Philip K. Dick

Study Guide Electrical Science Theory N1

Creature Features: The Science Fiction, Fantasy, And Horror Movie Guide By John Stanley

Knockout Week. October 2015

Farewell, My Lovely (Philip Marlowe Mysteries)(Audio Theater Dramatization) By Raymond Chandler READ ONLINE

The Wonderful Wizard Of Oz (Modern Library Classics) By L. Frank Baum, Ray Bradbury

The History Of Photography READ ONLINE. By Margaret Vallencourt

To the Principals and Boards of Management of Second-Level Schools, Special Schools and the CEOs of Education and Training Boards

LIVESTOCK'S LONG SHADOW: ENVIRONMENTAL ISSUES AND OPTIONS

SOMNIO. DIRECTED BY Travis Milloy. PRODUCED BY Laurie Sheldon and Tom Eberts. WRITTEN BY Travis Milloy

Entertainment Film News Serenity

Frequently Asked Questions. For BookDaily Emerging Authors

The Dark Knight By Frank Miller READ ONLINE

Contents. Introduction and Review... Pages 3 9 a) Basic Grammar Review b) Grammar Quiz c) Peer Editing d) Interview e) Topic Sentence

LAB LIT WRITING FICTION BASED ON REAL SCIENCE

Transition materials for A Level History

Knight Of The Dark Cross: An Action Horror Screenplay By John Wayne Hawkes READ ONLINE

June Textiles + Art & Jewelry M-F 9am-4pm 6/11-6/15 CAB n/a n/a. 56 Chess Camp M-F 9am-4pm 6/11-6/15 RMCC n/a n/a

Fantasy And Science Fiction Medievalisms: From Isaac Asimov To A Game Of Thrones READ ONLINE

DOWNLOAD OR READ : UNDEAD AHEAD THE ZOMBIE CHASERS 2 PDF EBOOK EPUB MOBI

The Minority Report By Philip K. Dick READ ONLINE

The Adventures Of The Lone Jack Kid: A Western Adventure (Western Fiction, By Joe Corso Book 1) By Joe Corso READ ONLINE

Name Distributor Where to Order Order # Cost. Overhead Dice (set of 2) Addison-Wesley Addison-Wesley SC $6.95 Publishers Publishers

Achievers, rejoice. 1 of 7 12/17/2014 3:15 PM

A Modern Utopia By H. G. Wells (World Cultural Heritage Library) By H. G. Wells READ ONLINE

Chocolate Chocolate Moons: Science Fiction Comic Mystery By Jackie Kingon READ ONLINE

TV Categories. Call for Entries Deadlines Pricing. National:

Copyright is owned by the Author of the thesis. Permission is given for a copy to be downloaded by an individual for the purpose of research and

English Extension HIGHER SCHOOL CERTIFICATE EXAMINATION. Total marks 50 Attempt TWO questions from the module you have studied

Introduction to Filmmaking

AN INTRODUCTION TO POPULAR GENRES

TV Categories. Call for Entries Deadlines Pricing. National: 1 Actress in a Leading Role - Comedy or Musical [TV National]

HOOVER TIMES LATE SPRING 2013 HOOVER TIMES. Hoover Street Elementary School Vol. 1, No. 2. The Life of Matt Martin

ART History and Appreciation of Art

DOWNLOAD OR READ : BLOODHYPE PDF EBOOK EPUB MOBI

ID The Popularity in Pride and Prejudice: Focusing on Elizabeth Bennet. Summary

Movies UNIT LEARNING OBJECTIVES. 1 What do these images have in common? 2 Do you like movies? What would be an iconic symbol of this art for you?

PURPOSE: To excite your audience with an adrenaline-stirring, fast-paced, big-event story.

The Lucidites Boxed Set: A YA Science Fiction Fantasy Adventure By Sarah Noffke

THE FUTURE OF STORYTELLINGº

Transcription:

Relational Algebra: Aggregation Database Schema Problems 1. Find the most popular movie genres. 2. Find the people that achieved the 10 highest average ratings for the movies they cinematographed. 3. Find the actors/actresses that achieved the 10 highest average ratings for the movies they played in and have played in at least 5 movies. 4. Find the pairs of people that have directed at least 5 movies and whose carees do not overlap (i.e. The release year of a director's last movie is lower than the release year of another director's first movie).

Answers 1. τ count DESC Ρ count = count(*) genre = g.label π g.label, count(*) ϒ g.genre_id, count(*) mg.genre_id = g.genre_id movie_genres mg genres g SELECT g.label as genre, count(*) as count FROM genres g JOIN movie_genres mg ON g.genre_id = mg.genre_id GROUP BY g.genre_id ORDER BY count DESC; + + + genre count + + + Drama 154 Thriller 65 Crime 57 Adventure 54 Action 43 Mystery 41 Comedy 40 Fantasy 33 Romance 32 War 28 Sci Fi 24 Biography 21 Family 19 Animation 17 History 15 Western 12 Film Noir 10 Horror 9 Sport 6 Musical 5 Short 3 Music 1 + + +

2. Ρ τ average_rating DESC average_rating = avg(m.rating) π p.name, avg(m.rating) ϒ p.person_id, avg(m.rating) c.movie_id = m.movie_id p.person_id = c.person_id people p movies m cinematographers c SELECT p.name, avg(m.rating) as average_rating FROM people p JOIN cinematographers c ON p.person_id = c.person_id JOIN movies m ON c.movie_id = m.movie_id GROUP BY p.person_id ORDER BY average_rating DESC LIMIT 10; + + + name average_rating + + + Dezcallar, Jaime 8.9 Cronenweth, Jeff 8.8 Suschitzky, Peter 8.8 Lesnie, Andrew 8.77 Burgess, Don 8.7 Pope, Bill (I) 8.7 Sekula, Andrzej 8.65 Biroc, Joseph F. 8.6 Russell, John L. 8.6 Milner, Victor 8.6 + + +

3. Ρ τ average_rating DESC average_rating = avg(m.rating) π p.name, avg(m.rating) σ count(*) >= 5 ϒ p.person_id, count(*), avg(m.rating) r.movie_id = m.movie_id p.person_id = r.person_id people p roles r movies m SELECT p.name, avg(m.rating) as average_rating FROM people p JOIN roles r ON p.person_id = r.person_id JOIN movies m ON r.movie_id = m.movie_id GROUP BY p.person_id HAVING count(*) >= 5 ORDER BY average_rating DESC LIMIT 10; + + + name average_rating + + + Freeman, Morgan (I) 8.6 Guinness, Alec 8.5 Baker, Kenny (I) 8.46 Ford, Harrison (I) 8.45 Hanks, Tom 8.44 O'Connor, Frank (I) 8.42 Jackson, Samuel L. 8.42 Bale, Christian 8.42 Moorhouse, Bert 8.417 Ermey, R. Lee 8.4 + + +

4. Ρ director_1 = p1.name first_movie_1 = min(m1.year) last_movie_1 = max(m1.year) director_2 = p2.name first_movie_2 = min(m2.year) last_movie_2 = max(m2.year) π p1.name, min(m1.year), max(m1.year), p2.name, min(m2.year), max(m2.year) σ max(m1.year) < min(m2.year) AND count(distinct m1.movie_id) >= 5 AND count(distinct m2.movie_id) >= 5 ϒ d1.person_id, d2.person_id, min(m1.year), max(m1.year), min(m2.year), max(m2.year), count(distinct m1.movie_id), count(distinct m2.movie_id) X d1.movie_id = m1.movie_id d2.movie_id = m2.movie_id movies m1 movies m2 d1.person_id = p1.person_id d2.person_id = p2.person_id directors d1 people p1 people p2 directors d2

SELECT p1.name as director_1, min(m1.year) as first_movie_1, max(m1.year) as last_movie_1, p2.name as director_2, min(m2.year) as first_movie_2, max(m2.year) as last_movie_2 FROM directors d1, directors d2, people p1, people p2, movies m1, movies m2 WHERE d1.person_id = p1.person_id AND d2.person_id = p2.person_id AND d1.movie_id = m1.movie_id AND d2.movie_id = m2.movie_id GROUP BY d1.person_id, d2.person_id HAVING max(m1.year) < min(m2.year) AND count(distinct m1.movie_id) >= 5 AND count(distinct m2.movie_id) >= 5; + + + + + + + director_1 first last director_2 first last movie movie movie movie 1 1 2 2 + + + + + + + Chaplin, Charles 1921 1940 Kubrick, Stanley (I) 1956 1987 Chaplin, Charles 1921 1940 Scorsese, Martin 1976 2010 Chaplin, Charles 1921 1940 Spielberg, Steven 1975 1998 Chaplin, Charles 1921 1940 Tarantino, Quentin 1992 2009 Chaplin, Charles 1921 1940 Miyazaki, Hayao 1984 2004 Chaplin, Charles 1921 1940 Nolan, Christopher (I) 2000 2012 Chaplin, Charles 1921 1940 Wilder, Billy 1944 1960 Hitchcock, Alfred (I) 1940 1960 Scorsese, Martin 1976 2010 Hitchcock, Alfred (I) 1940 1960 Spielberg, Steven 1975 1998 Hitchcock, Alfred (I) 1940 1960 Tarantino, Quentin 1992 2009 Hitchcock, Alfred (I) 1940 1960 Miyazaki, Hayao 1984 2004 Hitchcock, Alfred (I) 1940 1960 Nolan, Christopher (I) 2000 2012 Kubrick, Stanley (I) 1956 1987 Tarantino, Quentin 1992 2009 Kubrick, Stanley (I) 1956 1987 Nolan, Christopher (I) 2000 2012 Spielberg, Steven 1975 1998 Nolan, Christopher (I) 2000 2012 Wilder, Billy 1944 1960 Scorsese, Martin 1976 2010 Wilder, Billy 1944 1960 Spielberg, Steven 1975 1998 Wilder, Billy 1944 1960 Tarantino, Quentin 1992 2009 Wilder, Billy 1944 1960 Miyazaki, Hayao 1984 2004 Wilder, Billy 1944 1960 Nolan, Christopher (I) 2000 2012 + + + + + + +