Write a query to return the titles of the 5 shortest movies by duration.
The order of your results doesn't matter.
Table:
film
film
film_id
title
description
release_year
language_id
original_language_id
rental_duration
rental_rate
length
replacement_cost
rating
last_update
1
ACADEMY DINOSAUR
A Epic Drama of a Feminist And a Mad Scientist who must Battle a Teacher in The Canadian Rockies
2006
1
NULL
6
0.99
86
20.99
PG
2017-09-10 17:46:03.905795-07
2
ACE GOLDFINGER
A Astounding Epistle of a Database Administrator And a Explorer who must Find a Car in Ancient China
2006
1
NULL
3
4.99
48
12.99
G
2017-09-10 17:46:03.905795-07
col_name | col_type
----------------------+--------------------------
film_id | integer
title | text
description | text
release_year | integer
language_id | smallint
original_language_id | smallint
rental_duration | smallint
rental_rate | numeric
length | smallint
replacement_cost | numeric
rating | text
Sample results
title
---------------------
MOVIE 1
MOVIE 2
MOVIE 3
MOVIE 4
MOVIE 5
Solution
postgres
SELECT title
FROM film
ORDER BY length
LIMIT 5;
Explanation
This query retrieves the names of the top 5 shortest films in a database table called "film". It does this by selecting the "title" column in the table and ordering the results by the "length" column (presumably the duration of the film). The "LIMIT 5" clause at the end ensures that only the top 5 results are returned.
Copied
Last Submission
postgres
No submission yet for this engine. Run and submit your query to save it here.
Copied
Expected results
Submit a query to compare against expected output.