Sobes.tech
Intern — Middle
83

10 клиентов с наибольшим общим количеством покупок

Companies where asked:

Lamoda Tech
Task condition

Необходимо сформировать список из десяти клиентов, у которых суммарное количество приобретённых товаров максимально. Для подсчёта использовать столбец amount из таблицы carts.

-- Table "public.carts"
-- Column     | Type                        | Modifiers
-- -----------|-----------------------------|-----------------------------
-- sku        | bigint                      | not null
-- country    | country_enum                | not null
-- customer_id| bigint                      |
-- amount     | bigint                      | not null
-- updated_at | timestamp without time zone| default now()

-- Table "public.customer"
-- Column | Type  | Modifiers
-- -------|-------|----------------
-- id     | bigint| not null
-- email  | text  | not null