Aggregating strings
You are planning to update your storefront window to demonstrate how family-friendly and multi-lingual your DVD collection is. To prepare for this you need to prepare a comma-separated list G-rated film titles by language released in 2010.
This exercise is part of the course
Applying SQL to Real-World Problems
Exercise instructions
- Return a column with a list of comma-separated film
title
s by using theSTRING_AGG()
function. - Limit the results to films that have a
release_year
of2010
AND
have arating
of'G'
. - Ensure that the operation is grouped by the language
name
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
SELECT name,
___ AS film_titles
FROM film AS f
INNER JOIN language AS l
ON f.language_id = l.language_id
WHERE ___
AND ___
GROUP BY ___;