Deals Of The Week - 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. Name the last column count.

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.