Skip to content
Onsite

Monthly revenue report

EasyP2Coding

Table orders:

ColumnType
idint (primary key)
amountnumeric(10,2)
created_attimestamp (without time zone, already in the reporting time zone)

Report revenue per calendar month, oldest month first. Months with no orders are not listed.

Output columns: month (text, formatted YYYY-MM) and revenue (sum of amount).

Schema

CREATE TABLE orders (
  id int PRIMARY KEY,
  amount numeric(10,2) NOT NULL,
  created_at timestamp NOT NULL
);

Example 1

Input
orders: (1, 10.00, 2024-01-15), (2, 5.50, 2024-01-20), (3, 7.00, 2024-02-01)
Output
2024-01: 15.50, 2024-02: 7.00

Constraints

  • PostgreSQL dialect.

Hints

PostgreSQL
Run checks the 3 visible tests, Submit all 6.