Introduction
PARTITION BY
9. OVER(PARTITION BY) – practice 1
Summary

Instruction

Fantastic! Let's do a couple of practise exercises.

Exercise

For each journey, show its Id, the ProductionYear of the train on that journey, the number of journeys that train made (as TrainJourneys) and the number of journeys on that same route (as RouteJourneys).

Stuck? Here's a hint!

Use COUNT(Journey.Id) twice, but with a different OVER(PARTITION BY) clause. Join two tables.