Question
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.
I 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
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 testsStep 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