Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4.5 LAB - Nested aggregates - MIN of COUNT (Sakila) Refer to the film and inventory tables of the Sakila database. The tables in this

4.5 LAB - Nested aggregates - MIN of COUNT (Sakila)

Refer to the film and inventory tables of the Sakila database. The tables in this lab have the same columns and data types but fewer rows.

Write a query that lists the titles of films with the fewest rows in the inventory table.

This query requires a subquery that computes the minimum of counts by film_id:

SELECT MIN(count_film_id)

FROM ( SELECT COUNT(film_id) AS count_film_id

FROM inventory

GROUP BY film_id )

AS temp_table;

This subquery is provided in the template.

image text in transcribedI have tried

-- Your SELECT statement goes here SELECT Title FROM film WHERE film_id IN -- Use the following subquery: ( SELECT MIN(count_film_id) FROM ( SELECT COUNT(film_id) AS count_film_id FROM inventory GROUP BY film_id ) AS temp_table );

but it came out wrong

image text in transcribed

Refer to the film and inventory tables of the Sakila database. The tables in this lab have the same columns and data types but fewer rows. Write a query that lists the titles of films with the fewest rows in the inventory table. This query requires a subquery that computes the minimum of counts by film_id: SELECT MIN(count_film_id) FROM ( SELECT COUNT(film_id) AS count_film_id FROM inventory GROUP BY film_id) AS temp_table; This subquery is provided in the template. 304864.2684008.qxz7 \begin{tabular}{l|l} LAB & 4.5.1: LAB - Nested aggregates - MIN of COUNT (Sakila) \\ ACTIVITY & 4. \end{tabular} 0/10 Main.squ Load default template... \begin{tabular}{l|l} 1 & -- Your SELECT statement goes here \\ 2 & \\ 3 & \\ 4 & -- Use the following subquery: \\ 5 & (SELECT MIN(count_film_id) FROM \\ 6 & ( SELECT COUNT(film_id) AS count_film_id \\ 7 & FROM inventory \\ 8 & GROUP BY film_id) \\ 9 & AS temp_table); \end{tabular} Only show failing tests

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions