Back-To-School Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Exercises

Instruction

Here is another one!

Exercise

Select the name, rating, city of origin, and the total number of concerts it held in Ukraine for each orchestra that originated in Germany.

Stuck? Here's a hint!

First, select the name, rating, and city of origin for each orchestra from Germany (no need for a subquery here). Then, add a correlated subquery in the SELECT clause, which will count the number of concerts held in Ukraine by the given orchestra.

An example of a correlated subquery in SELECT looks like this:

SELECT 
   name, 
   (SELECT AVG(age) FROM cats c2 WHERE c2.name = c1.name)
FROM cats c1

This query finds the name of the cat together with the average age of all cats with the same name.