Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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 PM

Explanation / 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;