Introduction
PARTITION BY
11. OVER(PARTITION BY) – practice 3
Revision

Instruction

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

Exercise

For each ticket, show its id, price and, the column named ratio. The ratio is the ticket price to the sum of all tickets purchased on the same journey.

Stuck? Here's a hint!

In order to avoid integer division, you can write CAST(price AS numeric).

Console

Code editor

Result

TableConsole