MIcrosoft Access Query 5 (2 pts) For each theatre, find the smallest and largest
ID: 3732393 • Letter: M
Question
MIcrosoft Access Query 5 (2 pts)
For each theatre, find the smallest and largest runtimes of the movies played in this theatre. Output a table consisting of three columns: Theatre, Shortest, Longest
Showtimes Theatre Title Day Showtime Landmark Django Unchained Sat 6:00:00 PM Music Box Django Unchained Wed 8:40:00 PM The Gene Siskel Django Unchained Sun 3:30:00 PM The Gene Siskel Django Unchained Sun 11:50:00 AM Century 12 Goodfellas Thu 12:30:00 PM Century 12 Goodfellas Fri 7:00:00 PM Century 12 Pulp Fiction Thu 10:00:00 AM Landmark Pulp Fiction Fri 6:00:00 PM Music Box Pulp Fiction Fri 6:20:00 PM Landmark The Departed Fri 5:30:00 PM Music Box The Departed Wed 5:30:00 PM The Gene Siskel The Departed Sat 5:30:00 PMExplanation / Answer
I am assuming Title of Movies table is primary key which is referenced by Title of Showtimes table.
Aggregate function MIN() and MAX() is used to get shortest and longest runtime. Group by clause is used to group the result theater wise.
Query-
SELECT s.Theatre, MIN(m.Runtime), MAX(m.Runtime)
FROM Movies AS m
INNER JOIN Showtimes AS s
ON m.Title = s.Title
GROUP BY s.Theater;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.